gpt4 book ai didi

angular - 没有参数值的路由; Angular 路由重定向 - 我可以使用 redirectTo 来参数路径吗?

转载 作者:行者123 更新时间:2023-12-05 08:33:20 27 4
gpt4 key购买 nike

如果可以将路径:''重定向到路径:':id',我正在徘徊?有什么办法可以实现吗?

谢谢。

{
path: 'folder',
children: [
{
path: '',
redirectTo: ':id',
pathMatch: 'full',
},
{
path: ':id',
canActivate: [AuthGuard],
component: DocumentsComponent,
},
]
}

最佳答案

我找到了一种使用空“id”参数将“文件夹”路由重定向到“文件夹/:id”的方法:

{
path: 'folder',
redirectTo: 'folder/',
pathMatch: 'full',
},
{
path: 'folder',
children: [
{
path: ':id',
canActivate: [AuthGuard],
component: DocumentsComponent,
},
]
}

*请注意重定向必须在前。

关于angular - 没有参数值的路由; Angular 路由重定向 - 我可以使用 redirectTo 来参数路径吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41899090/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com