我在我的Angular 2应用程序中有一个仪表板路由,它有几个子路由。
{ path: 'app/:property', component: DashboardComponent, canActivate: [AuthGuardService],
children: [
{ path: 'home', component: HomeComponent }
{ path: 'welcome-slide', component: WelcomeSlideComponent }
{ path: 'analytics', component: AnalyticsComponent }
]
},
有没有一种方法可以让我获得一个带有路径(也许还有一个名称)的子路由列表,然后我可以用它们来填充我的导航栏?
发布于 2017-02-23 11:06:15
this.router.config
虽然路由没有名称,但其他信息是可用的。
另请参阅https://angular.io/docs/ts/latest/api/router/index/Routes-type-alias.html
使用router.routerState
,您还可以迭代父路由器和子路由器以从它们获取路由。
https://stackoverflow.com/questions/42413873
复制相似问题