CanActivate

Interface defining the canActivate() function that must be implemented by a guard. Return value indicates whether or not the current request is allowed to proceed. Return can be either synchronous (boolean) or asynchronous (Promise or Observable).


interface CanActivate {
  canActivate(context: ExecutionContext): boolean | Promise<boolean> | Observable<boolean>
}

See also

Methods

canActivate()


canActivate(context: ExecutionContext): boolean | Promise<boolean> | Observable<boolean>

Parameters

Option Type Description
context ExecutionContext

Current execution context. Provides access to details about the current request pipeline.

Returns

boolean | Promise<boolean> | Observable<boolean> Value indicating whether or not the current request is allowed to proceed.