Manoj Kalla
Can Route have multiple CanActivate guard?

In Angular can we attached multile CanActivate guard on one route.

By Manoj Kalla in Angular on Jun 05 2024
  • Jayraj Chhaya
    Jun, 2024 28

    Yes, in Angular, you can attach multiple CanActivate guards to a single route. This feature allows you to implement complex authorization logic by chaining multiple guards together. Each guard in the chain must return true for the navigation to proceed. Here’s an example of how you can attach multiple guards to a route:

    1. const routes: Routes = [
    2. {
    3. path: 'secure',
    4. component: SecureComponent,
    5. canActivate: [AuthGuard, RoleGuard, PermissionGuard]
    6. }
    7. ];

    • 0


Most Popular Job Functions


MOST LIKED QUESTIONS