Cookies concent notice

This site uses cookies from Google to deliver its services and to analyze traffic.
Learn more
Skip to main content
This site is no longer updated.Head to Angular.devHome
/

This is the archived documentation for Angular v17. Please visit angular.dev to see this page for the current version of Angular.

DeprecatedGuard

The InjectionToken and @Injectable classes for guards and resolvers are deprecated in favor of plain JavaScript functions instead.. Dependency injection can still be achieved using the inject function from @angular/core and an injectable class can be used as a functional guard using inject: canActivate: [() => inject(myGuard).canActivate()].

Deprecated:

      
      type DeprecatedGuard = ProviderToken<any> | any;
    

See also