在我的 TestComponent 中,我有一个导航栏,其中包含指向多个组件的链接,我想在 TestComponent 中的子路由器导出中显示这些组件,但它会引发此错误。
core.js:6237 ERROR Error: Uncaught (in promise): Error: Cannot match any routes. URL Segment: 'dashboard/test/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'
}
]
}
]
}
];
最佳答案
你的routerLink应该是
[routerLink]="['/dashboard/test', {outlets: { sub: ['id'] } }]"
关于javascript - 子 socket 中的 Angular 子路线,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61558872/