[英]Angular child route in sub outlet
In my TestComponent I have a navbar with the links to multiple components that I want to display in a sub router outlet which is in the TestComponent, but it throws this error.在我的 TestComponent 中,我有一个导航栏,其中包含指向多个组件的链接,我想在 TestComponent 中的子路由器插座中显示这些组件,但它会引发此错误。
core.js:6237 ERROR Error: Uncaught (in promise): Error: Cannot match any routes.
core.js:6237 错误错误:未捕获(承诺中):错误:无法匹配任何路由。 URL Segment: 'dashboard/test/id'
URL 段:“仪表板/测试/ID”
const routes: Routes = [
{
path: '',
redirectTo: 'dashboard/test',
pathMatch: 'full'
},
{
path: 'dashboard',
children: [
{
path: 'test',
component: TestComponent,
children: [
{
path: '',
redirectTo: 'id',
pathMatch: 'full'
},
{
path: 'id',
component: IdComponent,
outlet: 'sub'
}
]
}
]
}
];
Your routerLink should be你的 routerLink 应该是
[routerLink]="['/dashboard/test', {outlets: { sub: ['id'] } }]"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.