• Overview
@angular/router

mapToCanActivateChild

function
stable

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

API

mapToCanActivateChild

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

Usage {@example router/utils/functional_guards.ts region='CanActivate'}

@paramprovidersType<CanActivateChild>[]

Description

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

Usage

@Injectable({providedIn: 'root'})export class AdminGuard {  canActivate() {    return true;  }}const route: Route = {  path: 'admin',  canActivate: mapToCanActivate([AdminGuard]),};
Jump to details