我想在路由中使用 canActivate 保护而不重复
canActivate: [AuthGuard],
如下代码
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' }
},
]
}];