angular-docs-cn/packages/router
Andrew Scott d3a817549b fix(router): fix navigation ignoring logic to compare to the browser url (#37408)
This PR changes the logic for determining when to skip route processing from
using the URL of the last attempted navigation to the actual resulting URL after
that transition.

Because guards may prevent navigation and reset the browser URL, the raw
URL of the previous transition may not match the actual URL of the
browser at the end of the navigation process. For that reason, we need to use
`urlAfterRedirects` instead.

Other notes:
These checks in scheduleNavigation were added in eb2ceff4ba
The test still passes and, more surprisingly, passes if the checks are removed
completely. There have likely been changes to the navigation handling that
handle the test in a different way. That said, it still appears to be important
to keep the checks there in some capacity because it does affect how many
navigation events occur. This addresses an issue that came up in #16710: https://github.com/angular/angular/issues/16710#issuecomment-634869739
This also partially addresses #13586 in fixing history for imperative
navigations that are cancelled by guards.

PR Close #37408
2020-06-11 19:03:40 -07:00
..
scripts refactor: move angular source to /packages rather than modules/@angular 2017-03-08 16:29:27 -08:00
src fix(router): fix navigation ignoring logic to compare to the browser url (#37408) 2020-06-11 19:03:40 -07:00
test fix(router): fix navigation ignoring logic to compare to the browser url (#37408) 2020-06-11 19:03:40 -07:00
testing docs(router): fix a typo in example code (#37309) 2020-06-01 17:19:45 -04:00
upgrade build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
.gitignore refactor: move angular source to /packages rather than modules/@angular 2017-03-08 16:29:27 -08:00
BUILD.bazel build: provide full paths to `ts_api_guardian_test_npm_package` and `ts_api_guardian_test` (#36034) 2020-03-12 09:49:00 -07:00
PACKAGE.md docs: add package doc files (#26047) 2018-10-05 15:42:14 -07:00
README.md docs(router): remove obsolete sections in README.md (#27880) 2019-01-11 11:15:59 -08:00
index.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
karma-test-shim.js build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
karma.conf.js feat(zone.js): upgrade zone.js to angular package format(APF) (#36540) 2020-06-11 11:08:48 -07:00
package.json Revert "build: remove wombot proxy registry from package.jsons for release (#37378)" (#37495) 2020-06-10 08:21:45 -07:00
public_api.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00

README.md

Angular Router

Managing state transitions is one of the hardest parts of building applications. This is especially true on the web, where you also need to ensure that the state is reflected in the URL. In addition, we often want to split applications into multiple bundles and load them on demand. Doing this transparently isnt trivial.

The Angular router is designed to solve these problems. Using the router, you can declaratively specify application state, manage state transitions while taking care of the URL, and load components on demand.

Guide

Read the dev guide here.