← All notes

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

Sources

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

Permanent ID: iil:note:b4nnwtgg

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.},
}

Markdown

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.