javascript - 子出口中的角子路线
问题描述
在我的 TestComponent 中,我有一个导航栏,其中包含指向多个组件的链接,我想在 TestComponent 中的子路由器插座中显示这些组件,但它会引发此错误。
core.js:6237 错误错误:未捕获(承诺中):错误:无法匹配任何路由。URL 段:'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'] } }]"
推荐阅读
- c# - 列表中可选对象的 FluentValidation
- tensorflow - InvalidArgumentError:不成功的 TensorSliceReader 构造函数:无法获取匹配文件...文件系统方案“[本地]”未实现
- java - Java中的元组赋值
- php - 在 PHP 中创建永久 SSH 隧道
- php - PHPOffice - PowerPoint:如何在我的 PowerPoint 幻灯片中绘制虚线?
- c# - 如何查看剃须刀页面访问列表属性
- asp.net - 如何在 ASP.Net mvc4 中添加会话变量
- maven - Gradle publishPubNamePublicationToRepoNameRepository 失败并显示“无法获取资源 [...] maven-metadata.xml”
- python - 如何通过在python xarray中添加一个额外的维度来将一个数组拆分为多个数组?
- python - 在 Windows Server 上运行时出现“unicode 错误”,但在我的电脑上运行正常