-
Notifications
You must be signed in to change notification settings - Fork 24.8k
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
feat(router): Set a different browser URL from the one for route matching #53318
base: main
Are you sure you want to change the base?
Conversation
f814cfa
to
6986a0a
Compare
|
I had the feeling that the preferred way of redirecting was to return a UrlTree from the guard rather than imperatively navigating from the guard. Also, I must say that using UrlTrees is quite confusing, especially for beginners. Common navigations (using routerLink or router.navigate) use strings or arrays of segments to navigate, but in order to redirect, we have to transform the string/array into a UrlTree, which is not intuitive. |
Yes, redirects should generally go through that mechanism.
It should and will be available, but I didn't feel that this feature needed to be blocked on having that available. Unfortunately the
Agreed. There are at least two reasons this PR is still in draft mode and one of them is that I'm not yet decided on the behavior here with
Two things here: It is a goal but I wouldn't say it's necessarily the only goal. The feature as proposed here is a lot more flexible than a |
6986a0a
to
6418b99
Compare
|
Thanks for the detailed explanations @atscott |
f953fd6
to
f12c0fc
Compare
f12c0fc
to
ac71628
Compare
|
Thank you so much for building this @atscott ! We'll be using this the second it get's released. |
ac71628
to
cd1d524
Compare
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
…hing This feature adds a property to the `NavigationBehaviorOptions` that allows developers to define a different path for the browser's address bar than the one used to match routes. This is useful for redirects where you want to keep the browser bar the same as the original attempted navigation but redirect to a different page, such as a 404 or error page. fixes angular#17004
cd1d524
to
bb915ac
Compare
This feature adds a property to the
NavigationBehaviorOptionsthat allows developers to define a different path for the browser's address bar than the one used to match routes. This is useful for redirects where you want to keep the browser bar the same as the original attempted navigation but redirect to a different page, such as a 404 or error page.fixes #17004