Guard Children Routes
...
const routes: Routes = [
....
{
path: '',
component: AdminLayout, // Parent route
children: [
{
path: 'dashboard', // Child route that requires authentication
loadChildren: () => import('./demo/dashboard/dashboard.module').then((m) => m.DashboardModule),
canActivateChild: [AuthGuardChild], // Applying AuthGuard only to this child route
},
....
]
}
....
]Last updated