mapToCanMatch
Maps an array of injectable classes with canMatch functions to an array of equivalent
CanMatchFn
for use in a Route
definition.
mapToCanMatch(providers: Type<{ canMatch: CanMatchFn; }>[]): CanMatchFn[]
Parameters
providers
|
Type<{ canMatch: CanMatchFn; }>[] |
Returns
See also
Description
Usage
@Injectable({providedIn: 'root'})
export class AdminGuard {
canActivate() {
return true;
}
}
const route: Route = {
path: 'admin',
canActivate: mapToCanActivate([AdminGuard]),
};