You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
getCurrentNavigation() returns a Navigation object even after NavigationEnd #62958
Which @angular/* package(s) are the source of the bug?
router
Is this a regression?
No
Description
According to the Angular documentation, the router.getCurrentNavigation() method should return null once navigation has completed. However, when subscribing to the Router events and listening for the NavigationEnd event, router.getCurrentNavigation() still returns a non-null Navigation object.
Expected Behaviour: router.getCurrentNavigation() should return null when the NavigationEnd event is emitted.
Actual Behavior: router.getCurrentNavigation() continues to return a Navigation object even during the NavigationEnd event.
Please provide a link to a minimal reproduction of the bug
It’s a reasonable assumption, though NavigationEnd also emits before the title is set and before the promise for the navigation resolves. One could also argue “how can there be a NavigationEnd if there is no current navigation?”
It’s unlikely this timing would ever change, as ordering changes in the router are typically breaking and the benefits are likely not worth the churn.
Activity
atscott commentedon Aug 1, 2025
It’s a reasonable assumption, though
NavigationEndalso emits before the title is set and before the promise for the navigation resolves. One could also argue “how can there be a NavigationEnd if there is no current navigation?”It’s unlikely this timing would ever change, as ordering changes in the router are typically breaking and the benefits are likely not worth the churn.
atscott commentedon Aug 1, 2025
Updating priority to address this as a documentation bug, ie by adding a microtask before reading the current navigation.
Cc @bencodezen
feat(router): add a `currentNavigation` signal to the `Router` service.
feat(router): add a `currentNavigation` signal to the `Router` service.
feat(router): add a `currentNavigation` signal to the `Router` servic…
feat(router): add a currentNavigation signal to the Router service. (a…
feat(router): add a currentNavigation signal to the Router service.
feat(router): add a currentNavigation signal to the Router service.
feat(router): add a currentNavigation signal to the Router service.
feat(router): add a currentNavigation signal to the Router service.
feat(router): add a currentNavigation signal to the Router service.
feat(router): add a currentNavigation signal to the Router service.
feat(router): add a currentNavigation signal to the Router service.
feat(router): add a currentNavigation signal to the Router service.
feat(router): add a currentNavigation signal to the Router service. (a…
angular-automatic-lock-bot commentedon Sep 6, 2025
This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.
feat(router): add a `currentNavigation` signal to the `Router` servic…