I am trying to use lazy loaded module routes as shown below but it cannot find a match for the URL localhost:4200/authorization/opcodes. It can load the main page though.
src\app\app-routing.module.ts
const routes: Routes = [
{
path: '',
loadChildren: './modules/main-page/main-page.module#MainPageModule'
},
{
path: 'feature',
loadChildren: './modules/feature/feature.module#FeatureModule'
}
];
src\app\modules\main-page\main-page-routing.module.ts
const routes: Routes = [
{
path: '',
component: MainPageComponent,
canActivate: [AuthGuard],
children:[
{
path: 'authorization',
loadChildren: './authorization/authorization.module#AuthorizationModule'
}
]
}
];
src\app\modules\main-page\authorization\authorization-routing.module.ts
const routes: Routes = [
{
path: 'opcodes',
component: OpCodeComponent
}
];
@NgModule({
imports: [RouterModule.forChild(routes)],
exports: [RouterModule]
})
MainPageComponent is the main layout that includes a router-outlet that will host the OpCodesComponent.
So the router flow should be: AppRouterModule --> MainPageRouterModule --> AuthorizationRouterModule.