import { Injectable } from '@angular/core';
      import { CanLoad, Route } from '@angular/router';
      @Injectable({providedIn: 'root'})
      export class NameGuard implements CanLoad {
        constructor() { }
        canLoad(route: Route) {
          return true;
      Typescript language logo
      your recipe card header background

      Angular Guard Can Load

      Angular TypeScript Recipes

      This code defines a class named NameGuard which implements the CanLoad interface. The class has a constructor which, when called, sets the property providedIn to root . The canLoad() method returns true so that the NameGuard class can be used to guard the loading of routes.

      Library: angular

      Shortcut: angular.guard.canload


        Add Comment

        Log in to add a comment

        Codiga - All rights reserved 2022.