-
Notifications
You must be signed in to change notification settings - Fork 26.6k
Description
I have seen quite a few tickets related to this on github, and quite a few posts on this topic involving various workarounds elsewhere on the internet, e.g. on Stack Overflow, but there still doesn't seem to be a proper, simple solution for this included within the framework.
This is my use case:
- I have 2 routes with components - A & B - which share a common parent root (C).
- I have a resolver configured on C. A & B both share the data from this resolver
- In component A, I am performing a server update of the shared data, before navigating to route B.
- When performing this navigation, I want to force the resolver on C to fire again, so that B can see the latest version of the data that has just been modified by A.
Just to be clear:
- I do not want the resolver on C to fire every time I navigate between child routes of C, and I definitely don't want all my other resolvers firing every time I navigate between child routes. So
onSameUrlNavigation
is too course a solution for this use case. - I want to be able to force all the resolvers to fire programatically, at the point of navigation, in specific situations as required - i.e. when I have just performed a server update and the route state has not yet been refreshed.
So I am looking for a parameter, or configuration option, that can be passed to Router.navigate()
or navigateByUrl()
that will force all the resolvers (and probably the guards) in the target route (hierarchy) to be re-executed.
E.g. something like the reload: true
option provided in the AngularJS UI router, see here: https://ui-router.github.io/ng1/docs/latest/interfaces/transition.transitionoptions.html#reload - although I believe that also causes all the components to be destroyed and re-created, which is probably not necessary in this case.