Angular2 : How to refresh resolver dependent components?

前端 未结 2 1270
滥情空心
滥情空心 2021-02-20 09:48

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

2条回答
  •  情歌与酒
    2021-02-20 10:44

    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.

提交回复
热议问题