Cookies concent notice

This site uses cookies from Google to deliver its services and to analyze traffic.
Learn more
Skip to main content
This site is no longer updated.Head to Angular.devHome
/

This is the archived documentation for Angular v17. Please visit angular.dev to see this page for the current version of Angular.

OnSameUrlNavigation

How to handle a navigation request to the current URL. One of:

See more...

      
      type OnSameUrlNavigation = 'reload' | 'ignore';
    

See also

Description

  • 'ignore' : The router ignores the request it is the same as the current state.
  • 'reload' : The router processes the URL even if it is not different from the current state. One example of when you might want this option is if a canMatch guard depends on application state and initially rejects navigation to a route. After fixing the state, you want to re-navigate to the same URL so the route with the canMatch guard can activate.

Note that this only configures whether the Route reprocesses the URL and triggers related action and events like redirects, guards, and resolvers. By default, the router re-uses a component instance when it re-navigates to the same component type without visiting a different component first. This behavior is configured by the RouteReuseStrategy. In order to reload routed components on same url navigation, you need to set onSameUrlNavigation to 'reload' and provide a RouteReuseStrategy which returns false for shouldReuseRoute. Additionally, resolvers and most guards for routes do not run unless the path or path params changed (configured by runGuardsAndResolvers).