我会在多个路由之间共享的子组件的构造函数中定义子路由配置,但它会引发冲突异常。
App路线配置:
AppComponent
ChildComponent中的嵌套路由:
...
@RouteConfig([
{
path: '/child-a/...',
name: 'ChildA',
data: {foo: 'A'},
component: ChildComponent, // <== Same component on route "A" and "B"
useAsDefault: true
},
{
path: '/child-b/...',
name: 'ChildB',
data: {foo: 'B'},
component: ChildComponent, // <== Same component on route "A" and "B"
}
])
export class App {}
但是当我从&#34;路线A&#34;到&#34;路线B&#34;,它引发了这个例外:
原始例外:配置&#39; / nested-z&#39;与现有的冲突 route&#39; / nested-z&#39;
Plunkr:http://plnkr.co/edit/xYsxtQE69GaM2kyohgNZ?p=preview
如何在多个父路由之间共享的组件上定义嵌套路由?