Cookies concent notice

This site uses cookies from Google to deliver its services and to analyze traffic.
Learn more
Skip to main content
Say hello to Angular's future home!Check out Angular.devHome
/

mapToCanActivateChild

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

See more...

      
      mapToCanActivateChild(providers: Type<{ canActivateChild: CanActivateChildFn; }>[]): CanActivateChildFn[]
    
Parameters
providers Type<{ canActivateChild: CanActivateChildFn; }>[]
Returns

CanActivateChildFn[]

See also

Description

Usage

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

const route: Route = {
  path: 'admin',
  canActivate: mapToCanActivate([AdminGuard]),
};