我确实有一个默认加载的延迟加载模块LazyLoadedComponent
当我去/lazy
。到目前为止,还可以。
该组件包含 2 个 router-outlet :
<router-outlet></router-outlet>
<router-outlet name="aux"></router-outlet>
该模块有以下路由:
const routes = [
{
path: '',
component: LazyLoadedComponent,
children: [
{
path: '',
component: NonAuxComponent
},
{
path: '',
component: AuxComponent,
outlet: 'aux'
}
]
}
];
当我去/lazy
我确实按预期加载了 3 个组件。
但是,如果我想更改显示路径AuxComponent
像那样 :
{
path: 'auxpath',
component: AuxComponent,
outlet: 'aux'
}
我尝试去/lazy(aux:auxpath)
它不起作用。
我也尝试使用该网址routerLink
像那样 :
<a [routerLink]="[{ outlets: { aux: 'auxpath' } }]">Load an auxiliary route</a>
但它也不起作用。
这是路由器的错误吗?难道只是我在这里错过了一些东西吗?
您可以查看Plunkr http://plnkr.co/edit/TiwzIoR8t57yRrx8zpaQ?p=preview进行自己的测试。