Suggest an editImprove this articleRefine the answer for “What does CanActivate do?”. Your changes go to moderation before they’re published.Approval requiredContentWhat you’re changing🇺🇸EN🇺🇦UAPreviewTitle (EN)Short answer (EN)**CanActivate** is a route guard that decides whether a route can be entered: if it returns `true`, the route opens; if `false`, navigation is blocked. **Key point:** CanActivate is an entry filter that checks whether the user has the right to access that route.Shown above the full answer for quick recall.Answer (EN)Image`CanActivate` is a **route guard** that **decides whether a route can be entered**. If it returns `true`, the route opens. If `false`, navigation is blocked (Angular stays on the current page). --- ### Example: ```typescript @Injectable({ providedIn: 'root' }) export class AuthGuard implements CanActivate { canActivate(): boolean { return isUserLoggedIn(); // or token-check logic } } ``` --- ### Usage: ```typescript { path: 'dashboard', component: DashboardComponent, canActivate: [AuthGuard] } ``` --- ### What it can return: - `true` / `false` - a synchronous decision - `Observable<boolean>` or `Promise<boolean>` - if the check is asynchronous (for example, a server request) --- **Summary:** `CanActivate` is an entry filter. It checks: "Does the user have the right to access this route?". If not, it simply does not let them in.For the reviewerNote to the moderator (optional)Visible only to the moderator. Helps review go faster.