Skip to content

getCurrentNavigation() returns a Navigation object even after NavigationEnd #62958

Closed

Description

@asfound

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.

Image

Please provide a link to a minimal reproduction of the bug

https://stackblitz.com/edit/angular-i278fkgd?file=src%2Fmain.ts

Please provide the exception or error you saw


Please provide the environment you discovered this bug in (run ng version)

Angular CLI: 20.1.1
Node: 22.14.0
Package Manager: npm 11.4.2
OS: darwin x64

Angular: 20.1.2
... cdk, common, compiler, compiler-cli, core, forms, material
... platform-browser, router

Package                      Version
------------------------------------------------------
@angular-devkit/architect    0.2001.1
@angular-devkit/core         20.1.1
@angular-devkit/schematics   20.1.1
@angular/build               20.1.1
@angular/cli                 20.1.1
@schematics/angular          20.1.1
rxjs                         7.8.2
typescript                   5.8.3
zone.js                      0.15.1

Anything else?

No response

Activity

  1. added
    P5
    on Aug 1, 2025
  2. atscott commented on Aug 1, 2025

    @atscott
    Contributor

    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.

  3. added
    P2
    and removed
    P5
    on Aug 1, 2025
  4. atscott commented on Aug 1, 2025

    @atscott
    Contributor

    Updating priority to address this as a documentation bug, ie by adding a microtask before reading the current navigation.

    Cc @bencodezen

  5. added
    area: docs
    on Aug 3, 2025
  6. added this to the Backlog milestone on Aug 3, 2025
  7. added a commit that references this issue on Aug 3, 2025
    c59b7d4
  8. added a commit that references this issue on Aug 4, 2025
    ced90b9
  9. added a commit that references this issue on Aug 5, 2025
    d00b3fe
  10. added 2 commits that reference this issue on Aug 5, 2025
    feb070a
    9307c27
  11. reopened this on Aug 5, 2025
  12. added 7 commits that reference this issue on Aug 5, 2025
    5eefd1f
    0041391
    457f8d9
    a7e1722
    32f84e5
    78f36a9
    e650fb4
  13. added a commit that references this issue on Aug 6, 2025
    687c374
  14. angular-automatic-lock-bot commented on Sep 6, 2025

    @angular-automatic-lock-bot

    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.

  15. locked and limited conversation to collaborators on Sep 6, 2025
  16. added a commit that references this issue on Mar 3, 2026
    16097b5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2area: docs

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions