I would like to configure my lazy loaded routes nested, which are only available if the users is logged in. Authentication works with Auth0s and it's corresponding AuthGuard. So for example my routes look like this :
const routes: Routes = [
{
path: ':id',
children: [
{
path: '',
children: [ {
path: 'first-component',
loadChildren: () => import('./first-component.module').then((m) => m.FirstComponentModule),
canLoad: [AuthGuard],
},
{
path: 'second-component',
loadChildren: () => import('./second-component.module').then((m) => m.SecondComponentModule),
canLoad: [AuthGuard],
},
],
},
{
path: '',
pathMatch: 'full',
redirectTo: 'first-component',
},
],
},
{
path: ':id',
redirectTo: ':id',
pathMatch: 'full',
},
{
path: '**',
component: PageNotFoundComponent,
},
];
the :id
paramter is needed, and should stay in the url so it should look like this:
my-app/ID123/first-component
But authentication I am redirected to /ID123 -> not found
What am I missing?