I want to use the canActivate guard in routing without repeating the
canActivate: [AuthGuard],
code like below
import { AuthGuard } from 'src/app/core/guards/auth.guard';
const routes: Routes = [{
path: '', data: { title: 'Users' },
children: [
{
path: 'createuser',
canActivate: [AuthGuard],
component: UserComponent,
data: { title: 'Create User' }
},
{
path: 'updateuser',
canActivate: [AuthGuard],
component: UpdateUserComponent,
data: { title: 'Update User' }
},
]
}];
In your example you can use canActivateChild
so this auth guard will be applied to all children