Angular 2 roles and permissions
I have used angular2 and laravel 5.3 in my project. in laravel when user logged in server will be send the permissions of the user to handle authorization in angular. so I wrote a guard to protect routes from users that cannot access. here is my guard class code: export class AccessGuard implements CanActivate{ permissions; currentRoute; constructor(private authService:AuthService,private router:Router){ this.permissions = this.authService.getPermissions(); } canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot){ return this.checkHavePermission(state.url); } canActivateChild