Functional Route Guards
Explain CanActivate and related guards as functions, and how they control whether navigation is allowed to proceed.
Route guards let you intercept navigation before it completes, deciding whether it should be allowed, redirected, or blocked entirely — the classic use case is preventing an unauthenticated user from reaching a protected route. Since Angular 14.2, guards can be written as plain functions (CanActivateFn, CanDeactivateFn, etc.) rather than injectable classes implementing an interface, and since Angular 15+ this functional style is the recommended default, mirroring the same shift functional interceptors made.
A route guard is like a bouncer checking IDs at a club entrance — you don't get in without the right credentials, but if you don't qualify, the bouncer can point you toward a different, appropriate entrance (a redirect) instead of just leaving you standing on the sidewalk.