July 2018
Intermediate to advanced
420 pages
8h 46m
English
Guards are implemented as services that need to be provided, so we typically create a guard class using the Angular CLI:
ng g guard pages/auth/_guards/auth
The previous code will generate the following file: ./Client/src/app/pages/auth/_guards/auth.guard.ts.
import { AuthService } from '../_services/auth.service';
constructor(
private router: Router,
private auth: AuthService) {}
Read now
Unlock full access