angular-docs-cn/aio/content/examples/router
Andrew Scott 8a56c99f87 docs(router): Update router guide to use UrlTree for guard redirects (#37100)
The current implementation for redirecting users inside guards was in place
before the feature was added to allow `CanActivate` and `CanActivateChild` guards
to return `UrlTree` for redirecting users.

Returning `UrlTree` should be the default method, as it provides a more desirable
redirecting experience. When using `router.navigate` followed by `return false`,
the `Router` calls `resetUrlToCurrentUrlTree` (in the `finalize` operator) before
processing the navigation to the new route.  This can result in an undesirable
history if the navigation was the first navigation in the application - that is,
the route will briefly be reset to just `/` (see #36187).

Fixes #36187

PR Close #37100
2020-05-14 12:23:35 -07:00
..
e2e/src docs: fix redirect with secondary outlet in router guide example (#29267) 2019-03-14 10:51:52 -04:00
src docs(router): Update router guide to use UrlTree for guard redirects (#37100) 2020-05-14 12:23:35 -07:00
example-config.json docs(aio): update migrated content from anguar.io 2017-03-28 10:21:46 +01:00
stackblitz.json build(docs-infra): always specify a landing file for StackBlitz projects (#34553) 2020-01-22 13:45:23 -08:00