How to refresh a route's resolved data

前端 未结 4 1286
执笔经年
执笔经年 2021-01-04 01:09

Consider the following route configuration:

const routes: Routes = [
  {
    path: \'\',
    component: AppComponent,
    resolve: {
      app: AppResolver
          


        
4条回答
  •  清酒与你
    2021-01-04 01:39

    I've tested the solution 'runGuardsAndResolvers', it works for my use case, the resolver is called at each sub-page changes.

    It is only adding this option the part of your routes that you want behave this way.

    export const ROUTES: any = [
      {
        path: 'project/:name',
        runGuardsAndResolvers: "always",
        component: ProjectComponent,
        resolve: { project: ProjectResolver },
        children: [
          ...
    

提交回复
热议问题