0
0
llucycodes42
The @Injectable() decorator allows us to inject the NameGuard class into our application. The constructor of the NameGuard class sets up the canActivate method which returns true if the user can activate the route.
Library: angular
Shortcut: a_guard_can_activate
import { Injectable } from '@angular/core';
import { ActivatedRouteSnapshot, CanActivate, RouterStateSnapshot } from '@angular/router';
@Injectable({providedIn: 'root'})
export class NameGuard implements CanActivate {
constructor() { }
canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot) {
return true;
}
}