I\'m working on an app that has a lot of roles that I need to use guards to block nav to parts of the app based on those roles. I realize I can create individual guard class
Instead of using forRole(), you can do this:
{
path: 'super-user-stuff',
component: SuperUserStuffComponent,
canActivate: RoleGuard,
data: {roles: ['SuperAdmin', ...]}
}
and use this in your RoleGuard
canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot)
: Observable | Promise | boolean {
let roles = route.data.roles as Array;
...
}