I have two router-outlet components in my app component. How can I successfully lazy-load the nested route which is secondary router-outlet?
I have the following routes in the MerchandiseListComponent, this component loads just fine:
const routes: Routes = [
{
path: "",
component: MerchandiseListComponent,
data: { animation: "MerchandiseListPage" },
children: [
{
path: ":id/edit",
outlet: "modal",
loadChildren:
"./merchandise-dialog-container/merchandise-dialog-container.module#MerchandiseDialogContainerModule"
},
{
path: "new",
outlet: "modal",
loadChildren:
"./merchandise-dialog-container/merchandise-dialog-container.module#MerchandiseDialogContainerModule"
}
]
}
];`
Here are routes for my lazy-loaded module merchandise-dialog-container.module:
const routes: Routes = [
{
path: "",
children: [
{
path: ":id/edit",
outlet: "modal",
component: MerchandiseDialogContainerComponent
},
{
path: "new",
outlet: "modal",
component: MerchandiseDialogContainerComponent
}
]
}
];
The problem when the MerchandiseListComponent
is loaded, none of the lazy-loaded routes are loaded, it just defaults back to the catch-all
path.