Core Concepts
This page outlines the core building blocks you will use when protecting navigation with go_router_guards.
RouteGuard
Section titled “RouteGuard”Guards encapsulate logic that decides whether navigation should continue, be redirected, or be blocked.
- Implement a guard by extending
RouteGuard
and overridingonNavigation
. - Use
resolver.next()
,resolver.redirect('/path')
, orresolver.block()
.
NavigationResolver
Section titled “NavigationResolver”The NavigationResolver
mediates control flow between guards and the router, enabling middleware‑style composition.
Guard composition
Section titled “Guard composition”Compose multiple guards into one with helpers:
guardAll([...])
— all must passguardAnyOf([...], { fallbackRedirect })
— at least one must passguardOneOf([...], { fallbackRedirect })
— exactly one must pass
Route mixins
Section titled “Route mixins”For type‑safe routes, mix in GuardedRoute
or GuardedShellRoute
and provide a guard
.
ConditionalGuard
Section titled “ConditionalGuard”Target or exclude specific paths with ConditionalGuard
while keeping logic in a single guard.
See the API Reference for full types, and follow the Get Started guide to try these concepts in code.