>

CODEMASTERYLAB

IDE PLATFORM
CoursesCommunity BlogsKnowledge GraphQuizzesInterview Prep

Sign in to track progress & earn XP

Sign In Create Account
>
Code Mastery Lab

Code Mastery Lab

Sign In

Route Guards — Protecting Routes and Resolving Data

Question 1 / 1

0:00
Core
Medium

An AuthGuard returns false when the user isn't logged in. A RoleGuard returns false when the user lacks the required role. Both are listed in canActivate: [AuthGuard, RoleGuard] on the /admin route. An unauthenticated user navigates to /admin. What happens?

typescript const routes: Routes = [{ path: 'admin', component: AdminComponent, canActivate: [AuthGuard, RoleGuard] }];

// AuthGuard.canActivate() returns false for unauthenticated users // RoleGuard.canActivate() returns false for non-admin users