Open rms2219 opened 2 months ago
I should add, as a workaround for the time being, I've made use of both canMatch
and canActivate
route guards on the routes that are affected. I've used my authGuard
w/ canMatch
and ngxPermissionsGuard
with canActivate
.
I'm submitting a...
Current behavior
If the permissions guard is configured with a redirect, and the permissions test fails, the guard uses the
Router
service to navigate to the configured route.Expected behavior
As of Angular 7.1, router guards can return a boolean or an instance of
UrlTree
. By returning aUrlTree
instead of using the router to do the navigation, we can prioritize redirects when there are multiple guards applied to a route, both with competing redirects.Minimal reproduction of the problem with instructions
The code above will navigate to the "unauthorized" route instead of "login", even though the
authGuard
guard has priority.Environment