Luc*_*gni 12 html javascript routing typescript angular
是否可以在角度2路由中使用部分静态参数?我要解释一下:
现在我使用经典参数,如下所示:
const routes: Routes = [
{
path: ':type/fine.html',
pathMatch: 'full',
redirectTo: ':type/fine'
}
Run Code Online (Sandbox Code Playgroud)
但我可以使用这样的东西:
const routes: Routes = [
{
path: 'static-:type/fine.html',
pathMatch: 'full',
redirectTo: 'static-:type/fine'
}
Run Code Online (Sandbox Code Playgroud)
能够完全重定向到static-{{parameterValue}}/fine.
可能吗?
经过多次尝试,我已经达到了不可能做出类似事情的知识.所以我在这个例子之后用路由保护实现了一种完全不同的方法:
http://www.sparkbit.pl/angular-2-route-guards-real-life-example/
只是回答任何会发现同样问题的人.
| 归档时间: |
|
| 查看次数: |
444 次 |
| 最近记录: |