Options
All
  • Public
  • Public/Protected
  • All
Menu

Role guard implementation. Dictates access to routes depending on the user's role.

implements

CanActivate

Hierarchy

  • RoleGuard

Implements

  • CanActivate

Index

Constructors

Methods

Constructors

constructor

  • Instantiates the role guard class.

    Parameters

    • router: Router

      A service that provides navigation among views and URL manipulation capabilities.

    Returns RoleGuard

Methods

canActivate

  • canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): boolean | UrlTree | Observable<boolean | UrlTree> | Promise<boolean | UrlTree>
  • Returns whether navigation to a specific route is acceptable. Checks if the user has the required role to access the route.

    Parameters

    • route: ActivatedRouteSnapshot

      Contains the information about a route associated with a component loaded in an outlet at a particular moment in time. ActivatedRouteSnapshot can also be used to traverse the router state tree.

    • state: RouterStateSnapshot

      Represents the state of the router at a moment in time.

    Returns boolean | UrlTree | Observable<boolean | UrlTree> | Promise<boolean | UrlTree>

    true - If the user's role matches with accepted roles.

Generated using TypeDoc