使用路由器3.0.0-beta.2的Angular 2:是否可以在孩子旁边使用通配符?

时间:2016-08-05 09:58:22

标签: angular angular2-router3

我希望在其他/ parent / child旁边有一个像/ parent /:id这样的动态路由。

我试过这样的事情没有成功:

export const routes: RouterConfig = [ { path: '', component: HomeComponent }, { path: 'parent', component: ParentComponent,canActivate: [ WebpackAsyncRoute ], children: [ { path: ':id', component: 'ParamComponent' }, { path: 'child', component: 'ChildComponent' }, { path: 'anotherchild', component: 'AnotherChildComponent' } ] } ];

1 个答案:

答案 0 :(得分:0)

答案是肯定的。问题是我没有在组件上定义的路由配置上添加:id路径(因为我正在使用WebpackAsyncRoute)。所以没有任何与通配符路径相关的内容