GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Docs
  • Tutorials
  • Playground
  • Reference
  • code
  • CanActivateFn
  • Route

This view

  • Original page
  • New address

GeezerVison is showing next.angular.dev — mapToCanActivate • Angular

API

function mapToCanActivate(providers: Type<CanActivate>[]): CanActivateFn[];
@paramprovidersType<CanActivate>[]
@returnsCanActivateFn[]

Description

Maps an array of injectable classes with canActivate functions to an array of equivalent CanActivateFn for use in a Route definition.

Usage

@Injectable({providedIn: 'root'})
export class AdminGuard {
  canActivate() {
    return true;
  }
}

const route: Route = {
  path: 'admin',
  canActivate: mapToCanActivate([AdminGuard]),
};
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.