Force reload/refresh current route with RouteReuseStrategy
See original GitHub issueI’m submitting a … (check one with “x”)
[ ] bug report => search github for a similar issue or PR before submitting
[x] 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
With route reuse strategy that is supposed to not reuse a route (shouldReuseRoute
returns false
) a route is reloaded only if navigated URL is different (e.g. route param).
Currently route component is refreshed only when another route link is navigated. It is not clear if it is a bug or a missing feature.
Expected behavior Route component is expected to be refreshed when any route link is navigated, including the current one.
Minimal reproduction of the problem with instructions A plunk shows that route component is refreshed only when another route link is clicked.
What is the motivation / use case for changing the behavior?
Restore $route.reload()
functionality from Angular 1. Apparently, the only way to achieve it at this moment is to navigate to temporary route and back. See also #9105
-
Angular version: 2.4.2
-
Browser: [all]
- Language: [all]
Issue Analytics
- State:
- Created 7 years ago
- Reactions:4
- Comments:38 (9 by maintainers)
Hi,
If you really need to trick the Router into reloading the component on each routerLink click, you can use the following code in your Component
Hope this helps
Mihail C.
why do u want to reload it?