daffInsertDataPathStrategy

A route insertion strategy that can be used to append external routes onto existing Angular routes. This can be useful when you need to route to an existing lazy-loaded module from multiple externally defined urls.

This should be used in combination with the daffDataPathUrlMatcher to match lazy-loaded modules with associated external urls.

For example, you can provide the insertion strategy in the DaffExternalRouterModule as below.

DaffExternalRouterModule.forRoot({}, [
 {
   type: 'CATEGORY',
   insertionStrategy: daffInsertDataPathStrategy,
   route: {}
 }
],

Then, you can match it with an associated route defined in your Routing configuration with the daffDataPathUrlMatcher.

 export const routes: Routes = [
   {
     matcher: daffDataPathUrlMatcher,
     data: {
       daffExternalRouteType: "CATEGORY",
     },
     loadChildren: () => import('./category/category.module').then((m) => m.MyCategoryModule),
   }
]

See DaffRouteWithDataPath

Graycore, LLC © 2018 - 2024. Code licensed under an MIT-style License. Documentation licensed under CC BY 4.0.