-
Notifications
You must be signed in to change notification settings - Fork 27k
feat(router): Add ability to return UrlTree with NavigationBehaviorOptions from guards
#45023
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
3ac4a45 to
69e0965
Compare
69e0965 to
026813a
Compare
This comment was marked as outdated.
This comment was marked as outdated.
|
Results from running migration the migration internally: cl/427481595 |
026813a to
bfca0cf
Compare
AndrewKushnir
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great, just added a few comments.
e19d04e to
78ca5eb
Compare
aaab2ac to
c7a13d5
Compare
c7a13d5 to
94aca9f
Compare
94aca9f to
42d58d3
Compare
…rOptions` from guards Returning `UrlTree` from a guard was a convenient new feature added to the `Router`. However, it does not have feature-parity with the old `router.navigate(...); return false;` pattern. The most common use-case for this feature is to redirect to a new page _without_ updating the URL from the initially attempted navigation. For example, rendering a 404 page when the user does not have access privelages to a route. Fixes angular#17004 Fixes angular#27148 BREAKING CHANGE: Guards can now return `RedirectCommand` for redirects in addition to `UrlTree`. Code which expects only `boolean` or `UrlTree` values in `Route` types will need to be adjusted.
42d58d3 to
850c3b8
Compare
alxhub
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed-for: public-api
jessicajaniuk
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
reviewed-for: public-api
|
This PR was merged into the repository by commit 8735af0. |
|
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Returning
UrlTreefrom a guard was a convenient new feature added tothe
Router. However, it does not have feature-parity with the oldrouter.navigate(...); return false;pattern. The most common use-casefor this feature is to redirect to a new page without updating the URL
from the initially attempted navigation. For example, rendering a 404
page when the user does not have access privelages to a route.
Fixes #27148