Angular2 routing canActivate and AuthGuard (JWT) with user role parameter Angular2 routing canActivate and AuthGuard (JWT) with user role parameter javascript javascript

Angular2 routing canActivate and AuthGuard (JWT) with user role parameter


You can set the data parameter of the route with the role like this

const appRoutes: Routes = [{   path: 'account/super-secure',   component: SuperSecureComponent,   canActivate: [RoleGuard],   data: { roles: ['super-admin', 'admin'] } }];