I have an application with two lazy loading modules.
Main module:
const appRoutes = RouterModule.forRoot([
{path: '', redirectTo: '/welcome', pathMatch: 'full'},
{
path: 'guest',
loadChildren: 'app/guest-module/guest.module#GuestModule',
},
{
path: '',
loadChildren: 'app/user-module/user.module#UserModule',
},
{path: '**', component: NopageComponent},
],
);
Child module 1 (GuestModule):
const viewRoutes = RouterModule.forChild([
{path: 'overview/:reportId', component: HistoryOverviewComponent, canActivate: [GuestAuthGuard]},
]);
Child module 2 (UserModule):
const viewRoutes = RouterModule.forChild([
{path: 'overview/:reportId', component: HistoryOverviewComponent, canActivate: [UserAuthGuard]},
]);
When i route to /guest/overview/1 it always hit to the UserAuthGuard. Is it normal that children routes overlays each other?
Is there a way to distinguish them by configuration rather than changing names?
I use angular 5.2.9 with angular cli 1.7.3.