I have these routes
/items/:id
/items
/items/:id/edit
... etc
I want to put the component, to which I map /items/:id/edit, inside a separate lazy loaded module than the components to which the other routes are mapped.
I want to do this because the component associated to /items/:id/edit is very heavy and calls a lot of submodules that are not necessary for the other routes.
Ideally, I would like to do something like this configuration (that unfortunately doesn't work):
@NgModule({
imports: [
RouterModule.forRoot([
{ // If the route matches "items/:id/edit", then look inside this module
path: 'items/:id/edit',
loadChildren: './items_editor/items_editor.module#ItemsEditorModule',
},
{ // Otherwise look inside this other one
path: 'items',
loadChildren: './items/items.module#ItemsModule',
},
]);
],
});
At the moment, since I didn't find a way to achieve my goal, I worked around it by renaming the path to "items/:id/edit" into "items_editor/:id":
@NgModule({
imports: [
RouterModule.forRoot([
{
path: 'items',
loadChildren: './items/items.module#ItemsModule',
},
{
path: 'items-editor',
loadChildren: './items_editor/items_editor.module#ItemsEditorModule',
},
]);
],
});
However, I don't like this change because they are not REST names.
JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)