I have route like below, where am passing id as parameters. So the same ID I have to use inside the module for loading isolated translation file on a basis of route parameters.
const routes: Routes = [
{
path: 'flight/:id', loadChildren: () => import('./layout/base/base.module').then(m => m.BaseModule)
},
];
Now in BaseModule file I have to use :id data for loading some data. Is there any way so I can read or fetch route data in BaseModule file.
You can use this configuration to access parameters from the parent route:
Now you can access :id in base.module. But better name your params more specifically when using this approach.
Another way would be to climb the router state up:
You could use this function with the component that holds the router-outlet corresponding to the router config. For Example
The you could acces the id property with: