是否可以在 Angular 2 路由中使用部分静态参数? 我要解释:
现在我使用这样的经典参数:
const routes: Routes = [
{
path: ':type/fine.html',
pathMatch: 'full',
redirectTo: ':type/fine'
}
但我可以使用这样的东西:
const routes: Routes = [
{
path: 'static-:type/fine.html',
pathMatch: 'full',
redirectTo: 'static-:type/fine'
}
能够准确地重定向到 static-{{parameterValue}}/fine
。
这可能吗?
最佳答案
经过多次尝试,我发现不可能做类似的事情。所以我在这个例子之后用路由守卫实现了一种完全不同的方法:
http://www.sparkbit.pl/angular-2-route-guards-real-life-example/
只是回答任何会发现同样问题的人。
关于javascript - 部分静态路由参数angular 2,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49068606/