UNPKG

@everllence/ngx-chain-functional-guards

Version:

An Angular guard that executes functional guards in a serial manner, waiting for each one to complete before proceeding to the next.

16 lines (15 loc) 944 B
import { CanActivateChildFn, CanActivateFn, CanDeactivateFn } from '@angular/router'; /** * Chains route configured guards on canActivate or canActivateChild, calling them after each other, waiting for each one before calling the next. * * @param guards The array of guards to process. * @returns The result of the first guard that returns `false` or an instance of a `UrlTree`, otherwise `true`. */ export declare function chainActivationGuards(guards: CanActivateFn[] | CanActivateChildFn[]): CanActivateFn | CanActivateChildFn; /** * Chains route configured guards on canDeactivate, calling them after each other, waiting for each one before calling the next. * * @param guards The array of guards to process. * @returns The result of the first guard that returns `false` or an instance of a `UrlTree`, otherwise `true`. */ export declare function chainDeactivationGuards(guards: CanDeactivateFn<never>[]): CanDeactivateFn<never>;