Visitar URL original
mapToCanMatch • Angular
The Wayback Machine - https://web.archive.org/web/20260217024230/https://angular.dev/api/router/mapToCanMatch
    • Overview
@angular/router

mapToCanMatch

function
stable

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

API

function mapToCanMatch(providers: Type<CanMatch>[]): CanMatchFn[];

Description

Maps an array of injectable classes with canMatch functions to an array of equivalent CanMatchFn 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