使用“旧”新路由器(在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?
})
}
}