I have three components, each have their own resolver that fetch data from a different API. To do so, these components rely on an url, that is shared between them using a servic
It is not currently possible to refresh routes. It will probably be possible to do that with RouteReuseStrategy in Angular 2.3.
Resolvers are reevaluated when a route changes and can be observed from ActivatedRoute
. They are not reevaluated if a route stays the same (no param is changed) and should be designed accordingly.
Route change is asynchronous, the workaround is to chain route changes:
this.router.navigateByUrl('blank').then(() => {
this.router.navigateByUrl('home/(mapps:mobil//sw:simil//sf:sales)');
})
With angular 5 and higher its possible to rerun GuardsAndResolvers
From official documentation
By default they run only when the matrix parameters of the route change. When set to paramsOrQueryParamsChange they will also run when query params change. And when set to always, they will run every time.
{
path: 'some path',
runGuardsAndResolvers: 'paramsOrQueryParamsChange'
...
}
This should re-run guards and resolvers.