Angular 2 RC-1:动态添加路径到组件

时间:2016-05-05 17:39:53

标签: angular angular2-routing

使用“旧”新路由器(在rc1之前),我能够在运行时动态添加路由。

“新”新路由器(post rc1)有一个不同的api。如何使用它动态添加路由?

@Component({...})
export class MyComponent implements OnInit {
  constructor(private _router:Router, 
              private _appLoaderService:AppLoaderservice){}

  ngOnInit(){
    this._appLoaderService.loadApps().subscribe(app => {
      let route = app.componentRoute;
      this._router. //what happens here to add the route to MyComponent?
    })
  }
}

0 个答案:

没有答案