Executing resolvers one after the other in Angular 2+

后端 未结 4 1565
孤城傲影
孤城傲影 2021-02-04 03:50

Given the following route:

path: \'\',
component: MyComponent,
resolve: {
    foo: FooResolver,
    bar: BarResolver
}

Is there any way of tell

4条回答
  •  孤城傲影
    2021-02-04 04:50

    One other option is to wrap your dependent routes and use necessary resolver on wrapper.

    I.E.

    { path: '', resolve: { foo$: FooResolver }, children: [
        { path: 'mySubRoute', resolve:  {bar$: BarResolver }, component: BarComponent }
    ]}
    

    *If you meet with relative path resolving problems, try using

    relativeLinkResolution: "corrected"
    

    In forRoot router method. More info here Angular RouterLink relative path does not work in component having empty path

提交回复
热议问题