I have an app and I make the structure to have feature modules with owns routes:
// Here is the Feature Module
RouterModule.forChild([
{
path: ':cube_id/import-data',
component: ImportDataComponent,
canActivate: [CUBE_GUARD]
},
{
path: ':cube_id/consolidation',
component: ConsolidationComponent,
canActivate: [CUBE_GUARD]
}
....
// App routing:
const appRoutes: Routes = [
{
path: 'epic',
loadChildren: './traitement/traitement.module#TraitementModule'
},
{
path: 'not-authorized',
component: NotAuthorizedComponent
},
{
path: '',
component: HomeComponent,
pathMatch: 'full',
canActivate: [ HOME_GUARD ],
children: [
]
}
];
@NgModule({
imports: [
RouterModule.forRoot(appRoutes, {
useHash: true
})
],
providers: [
CurrentUserService,
GuardFactory.createGuard(HOME_GUARD, homeGuard)
],
exports: [ RouterModule ]
})
export class AppRoutingModule {
}
And in root app module I have imported the AppRoutingModule.
When I try to access the item from menu, I get this error:
core.js:1449 ERROR Error: Uncaught (in promise): Error: Cannot match any routes. URL Segment: 'epic/import-data'
Error: Cannot match any routes. URL Segment: 'epic/import-data'
If I import Features Modules in Root Module everything works fine. Any ideas what I'm doing wrong?
epic/<cube_id>/import-data?