ActivatedRoute.snapshot has old data when route changes
See original GitHub issueI’m submitting a … (check one with “x”)
[x] bug report => search github for a similar issue or PR before submitting
[ ] feature request
[ ] support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question
Current behavior ActivatedRoute.snapshot has old data. When route changes, ActivatedRoute.snapshot has data from previous route.
Expected behavior Documentation states that snapshot should be: “The current snapshot of this route.” (https://angular.io/docs/ts/latest/api/router/index/ActivatedRoute-interface.html) Which it is not.
Minimal reproduction of the problem with instructions http://plnkr.co/edit/LThOFFTawaUYg7L9oIXg?p=preview
Click on “First component” in menu and then click on “Increment self” several times.
What is the motivation / use case for changing the behavior? ActivatedRoute.snapshot should have current data even when route changes. It should not be delayed by 1 step.
-
Angular version: 2.1
-
Browser: [Chrome | Firefox | probably all]
-
Language: [TypeScript]
Issue Analytics
- State:
- Created 7 years ago
- Comments:17 (9 by maintainers)

Top Related StackOverflow Question
As far as I know,
ActivatedRoute.paramsis indeed changed before routing is actually complete. You can subscribe to the actual router events usingRouter.events, and wait forNavigationEnd. This seems to produce the results you are looking for. See the updated plunker here.This is what I dont like from angular to other SPA, different version, different buil-in function/syntac. Everything change and then new bug waiting for solution again.