Route guards control whether a user can enter or leave a route
Answer: Guards control whether a user can navigate to or leave a route. They act as checkpoints for access to specific routes. Common uses include authentication and access control.
Do not treat client-side guards as the only access control. JavaScript that runs in a browser can be modified by the person running the browser. Enforce authorization on the server as well.
Return types
All route guards share the same possible return types. boolean allows navigation when true and blocks it when false (with a note for CanMatch). A UrlTree or RedirectCommand redirects to another route instead of blocking. A Promise or Observable is also allowed: the router uses the first emitted value and then unsubscribes. A guard must emit a value.
In source
Helpers such as mapToCanActivate and mapToCanMatch map an array of injectable guard classes to equivalent functional guards (CanActivateFn, CanMatchFn) for use in a Route definition. mapToResolve maps an injectable class with a resolve method to a ResolveFn.
See also
Claims
- id: C1 claim: Route guards control whether a user can navigate to or leave a route. source: S1 evidence: "Route guards are functions that control whether a user can navigate"
- id: C2 claim: true allows navigation and false blocks it. source: S1 evidence: "
trueallows navigation,falseblocks it"
- id: C3 claim: mapToCanActivate maps injectable classes to CanActivateFn guards. source: S2 evidence: "Maps an array of injectable classes with canActivate functions to an array of equivalent"
- id: C4 claim: The mapped functions are for use in a Route definition. source: S2 evidence: "
CanActivateFnfor use in aRoutedefinition."
Sources
- [S1] Route guards. Angular docs. https://angular.dev/guide/routing/route-guards . License: CC BY 4.0. Accessed 2026-11-11.
- [S2] Functional guards. Angular source. https://github.com/angular/angular/blob/main/packages/router/src/utils/functional_guards.ts . License: MIT. Accessed 2026-11-11.
License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources and notices: Angular documentation (angular/angular adev): Copyright (c) 2010-2026 Google LLC; CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Angular source (angular/angular): Copyright (c) 2010-2026 Google LLC; MIT (https://raw.githubusercontent.com/angular/angular/main/LICENSE). Text was condensed and changed from the originals.
License: CC-BY-4.0 · Summary by iinventedlight (AI-assisted). Sources: Angular docs, CC BY 4.0 text (angular/angular adev footer); Angular source, MIT (angular/angular). Notices: Angular documentation (angular/angular adev): Copyright (c) 2010-2026 Google LLC; CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Angular source (angular/angular): Copyright (c) 2010-2026 Google LLC; MIT (https://raw.githubusercontent.com/angular/angular/main/LICENSE).
Cite this
iinventedlight. 2026. "Angular route guards decide whether navigation to a route may proceed." iinventedlight Library, iil:note:b4nnwtgg, version of 2026-11-11. https://iinventedlight.com/library/notes/angular-route-guards/. License: CC-BY-4.0.
@misc{iil_note_b4nnwtgg,
author = {{iinventedlight}},
title = {{Angular route guards decide whether navigation to a route may proceed}},
howpublished = {iinventedlight Library},
year = {2026},
date = {2026-11-11},
url = {https://iinventedlight.com/library/notes/angular-route-guards/},
note = {Permanent ID iil:note:b4nnwtgg. License: CC-BY-4.0.},
}
Spotted a mistake? Use the MCP feedback tool or email hello@iinventedlight.com.
For language models and agents: start at /llms.txt | /agents.md | /.well-known/agent-library.json. This page in Markdown: /library/notes/angular-route-guards.md.