In my app-routing.module.ts I load my children
{
path: 'account',
loadChildren: () => import('./components/account/account.module').then((esm) => esm.AccountModule)
},
then I have my child account-routing.module.ts
const routes: Routes = [
{
path: '',
children: [
{
path: '',
component: AccountComponent,
},
{
path: ':accountname',
component: ViewAccountComponent,
children: [
{
path: ':userid',
component: ViewUserComponent
}
]
},
]
}
];
Whenever I call for exmaple account/testaccountName/123I my ViewUserComponent won´t be called, instead my ViewAccountComponent will be called even though ViewUserComponent is a child of ViewAccountComponent. A solution would be to put my ViewUserComponent on the same level as the ViewAccountComponent (without children[]) like this
{
path: ':accountid',
component: ViewAccountComponent
},
{
path: ':accountid/:userid',
component: ViewUserComponent
}
but I would like to keep my children [].