angular-cn/aio/content
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
..
cli refactor(docs-infra): remove obsolete `format` attribute from code examples (#31674) 2019-07-24 14:38:54 -07:00
cli-src build(docs-infra): make the git ref for cli command docs configurable (#26391) 2018-10-11 12:57:49 -07:00
examples docs(router): Update router guide to use UrlTree for guard redirects (#37100) 2020-05-14 12:23:35 -07:00
guide docs(router): Update router guide to use UrlTree for guard redirects (#37100) 2020-05-14 12:23:35 -07:00
images docs: add Cindy to contributors (#37076) 2020-05-13 16:01:00 -07:00
marketing docs: add Cindy to contributors (#37076) 2020-05-13 16:01:00 -07:00
start docs: improve startup nav, naming, and terminology (#35533) 2020-04-22 17:08:29 -04:00
tutorial docs: improve startup nav, naming, and terminology (#35533) 2020-04-22 17:08:29 -04:00
file-not-found.md fix(docs-infra): do not create an anchor for the `file-not-found` header (#27250) 2018-12-05 13:26:26 -08:00
license.md build: bump year (#34651) 2020-01-13 07:21:43 -08:00
navigation.json docs: refactor lifecycle hooks doc topic for task orientation (#36353) 2020-05-13 15:51:21 -07:00