Routing
Understand the @aurelia/router package, its core concepts, and how to navigate the rest of the routing documentation.
Aurelia's primary router gives you a declarative, component-first navigation system with strong type safety, multi-viewport layouts, and deep integration with dependency injection. If you have used Angular's router or the classic Aurelia 1 router, the mental model will feel familiar: define a route table, map URLs to components, nest layouts, guard navigation, lazy-load feature areas, and respond to lifecycle events. The Aurelia router stays HTML-friendly and convention-driven, letting you compose navigation without wrapper modules or excessive configuration.
Still deciding between routers? Start with Choosing the right Aurelia router.
Highlights
Structured route tree lets you describe nested layouts, auxiliary viewports, and fallback routes in one place while still co-locating child routes with their components via
@route.Viewport-first layouts allow flexible page composition: declare multiple
<au-viewport>elements, name them, and target them from route definitions. This makes responsive shells and split views straightforward.Lifecycle hooks and events mirror the intent of Angular guards (
canLoad,canActivate, etc.) while using Aurelia conventions (canLoad,loading,canUnload,unloading). Hooks execute in well-defined order and support async work.Navigation state management gives you centralized insight into route activation, title building, and analytics hooks, ideal for larger apps.
Progressive enhancement via the
loadandhrefattributes keeps markup readable and usable even before hydration.
Refer to the package README for release notes and API exports: packages/router/README.md.
Choose the right guide
Work through the topics in this order when you are new to the router:
Lifecycle, hooks, and events
Support resources
Keep the live StackBlitz examples handy while you read; most topics embed a runnable demo.
Feature map
Configure base path, hash vs pushState, title building
RouterConfiguration.customize and RouterOptions
Where to go next
Explore targeted recipes in the developer guides.
Pair routing with state management via the store plugin or your preferred data layer.
Review the router package CHANGELOG when upgrading between versions.
Last updated
Was this helpful?