【发布时间】:2018-05-11 17:11:40
【问题描述】:
在我的应用程序中定义路由器时,我必须编写一个查询参数,然后通过调用 ActivatedRoute 在我的应用程序中解释该参数(该参数必须可检索以解决兼容性问题)。最近,我不得不定义一些不遵循相同路由逻辑的新子路由。
// Works but no param sent when myParam is selected
{
path: "myParam",
component: "MyComponent"
}, {
path: ":param",
children: [{/* */}]
}
//...
// doesn't work when first guard isn't ok
{
path: ":param",
component: "MyFirstComponent",
canActivate: [myGuardService]
}, {
path: ":param",
canActivate: [myOtherGuardService]
children: [{/* */}]
}
//...
首先,我尝试在通用路由之前定义特定路由,但未发送参数.. 然后,我尝试在同一级别上为每个人设置一个守卫,但是当第一个守卫不适用于输入时,该路线不再可访问。 这看起来很简单,但我无法找到一种方法来通过最少的代码更改来修复它 谢谢你的帮助
【问题讨论】:
标签: angular typescript routes