0
1
JRJose Romero
This code defines a class, NameGuard, that implements the CanActivate interface. This interface defines a single method, canActivate, which returns a boolean value. This method is called by the ActivatedRouteSnapshot constructor when the NameGuard class is injected into an ActivatedRoute. The RouterStateSnapshot constructor is used to obtain the current state of the router. If the route is activated, the canActivate method returns true. If the route is not activated, the canActivate method returns false.
Library: angular
Shortcut: angular.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;
}
}