Skip to content

Commit 6203f5e

Browse files
atscottthePunderWoman
authored andcommitted
docs: clarify onSameUrlNavigation behavior (#42275)
`onSameUrlNavigation` only affects whether the Angular Router processes the URL and runs it through the navigation pipeline, retriggering redirects, guards, and resolvers. The name `reload` is a little confusing because it does _not_ reload the component. Developers _also_ need to implement a custom `RouteReuseStrategy` to trigger a component reload on same URL navigation. Fixes #21115 PR Close #42275
1 parent 3abf365 commit 6203f5e

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

‎packages/router/src/router.ts‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -470,8 +470,16 @@ export class Router {
470470

471471
/**
472472
* How to handle a navigation request to the current URL. One of:
473+
*
473474
* - `'ignore'` : The router ignores the request.
474475
* - `'reload'` : The router reloads the URL. Use to implement a "refresh" feature.
476+
*
477+
* Note that this only configures whether the Route reprocesses the URL and triggers related
478+
* action and events like redirects, guards, and resolvers. By default, the router re-uses a
479+
* component instance when it re-navigates to the same component type without visiting a different
480+
* component first. This behavior is configured by the `RouteReuseStrategy`. In order to reload
481+
* routed components on same url navigation, you need to set `onSameUrlNavigation` to `'reload'`
482+
* _and_ provide a `RouteReuseStrategy` which returns `false` for `shouldReuseRoute`.
475483
*/
476484
onSameUrlNavigation: 'reload'|'ignore' = 'ignore';
477485

0 commit comments

Comments
 (0)