mirror of
https://github.com/angular/angular.git
synced 2026-09-14 13:54:52 +08:00
157415831c
Rather than the navigation transitions managing Router state, this commit updates the Router to manage its own state based on ongoing transition events. In the future, this can be abstracted even further to have a totally separate class that manages the Router state. This would allow the potential for swapping state manager implementations rather than having to implement all types of state management in a single place. One finding during tests was that unexpected errors thrown by the state management code moved to the Router here will no longer be caught by the transition pipe's `catchError`. This only includes calls to the following public Api methods: * `go`, `replaceState`, `historyGo`, `isCurrentPathEqualTo` on `Location` * `UrlSerializer.serialize` * `UrlHandlingStrategy.merge`. None of these methods should throw if the router is expected to function. These might throw when tests include incomplete mocks, which is not supported, or in cases where the actual browser methods like `replaceState` would throw. This will already result in unexpected/unsupported behavior. The failure case here is now arguably better - the navigation itself still completes but the state update (either updating Router internal state or updating the browser URL) fails separately and is unhandled. PR Close #48427
Angular
The sources for this package are in the main Angular repo. Please file issues and pull requests against that repo.
Usage information and reference details can be found in Angular documentation.
License: MIT