[英]partial static routing parameter angular 2
Is it possible to use a partial-static parameter in angular 2 routing? 是否可以在角度2路由中使用部分静态参数? I'm going to explain:
我要解释一下:
Now I'm using classic parameter like this: 现在我使用经典参数,如下所示:
const routes: Routes = [
{
path: ':type/fine.html',
pathMatch: 'full',
redirectTo: ':type/fine'
}
But I would be able to use something like this: 但我可以使用这样的东西:
const routes: Routes = [
{
path: 'static-:type/fine.html',
pathMatch: 'full',
redirectTo: 'static-:type/fine'
}
To be able to redirect exactly to static-{{parameterValue}}/fine
. 能够完全重定向到
static-{{parameterValue}}/fine
。
Is it possible? 可能吗?
After many tries i've reached the knowledge that is impossible to do something like it. 经过多次尝试,我已经达到了不可能做出类似事情的知识。 So i've implemented a completely different approach with a routing-guard following this example:
所以我在这个例子之后用路由保护实现了一种完全不同的方法:
http://www.sparkbit.pl/angular-2-route-guards-real-life-example/ http://www.sparkbit.pl/angular-2-route-guards-real-life-example/
Just answering for anyone who will find same problem. 只是回答任何会发现同样问题的人。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.