Сво*_*Роб 2 angular-routing angular2-routing angular
如果可以将 path: ' ' 重定向到 path: ':id' ,我正在徘徊?有没有办法实现这一目标?
谢谢你。
{
path: 'folder',
children: [
{
path: '',
redirectTo: ':id',
pathMatch: 'full',
},
{
path: ':id',
canActivate: [AuthGuard],
component: DocumentsComponent,
},
]
}
Run Code Online (Sandbox Code Playgroud)
我找到了一种使用空的“id”参数将“文件夹”路由重定向到“文件夹/:id”的方法:
{
path: 'folder',
redirectTo: 'folder/',
pathMatch: 'full',
},
{
path: 'folder',
children: [
{
path: ':id',
canActivate: [AuthGuard],
component: DocumentsComponent,
},
]
}
Run Code Online (Sandbox Code Playgroud)
*注意重定向必须是第一个。
| 归档时间: |
|
| 查看次数: |
2922 次 |
| 最近记录: |