Official website: router5.github.io
router5
A simple, powerful, modular and extensible router, organising your named routes in a tree and handling route transitions. In its simplest form, Router5 processes routing instructions and outputs state updates.
Router5 is library and framework agnostic, and makes no asumption on your implementation. It favours convention over configuration, by giving you the means to observe route changes and to react to them. Afterall, why treat route changes any different than data changes?
To get started, look here: Get started
Features
- Use of hash (#)
- Default start route: a default route to navigate to on load if the current URL doesn't match any route. Similar to
$routeProvider.otherwise()
in Angular ngRoute module. - Start and stop
- Nested named routes: routes are identified by names and parameters so you don't have to manipulate URLs directly. Routes can be nested, introducing the notion of route segments.
- Segments activation: you can control whether or not a route can be accessed by specifying a
canActivate
function per node. Supports asynchronous results. - Segments deactivation: you can register segment components. On a route change, it will ask those components through their
canDeactivate
method if they allow navigation. Similar to Angular 2 and Aurelia routers. Supports asynchronous results. - Custom plugins: extend your router behaviour with custom plugins
- Middleware functions: handle any data updates or other asynchronous actions with multiplebefore updating your view.
- Universal applications: use on client and server side
- You are in control! You decide what to do on a route change and how to do it.
Plugins
- router5-listeners: allows you to add route change and node listenerns. Node listeners are triggered if that named route node is the node a component tree needs to be re-rendered from.
- router5-history: updates your browser URL and state using HTML5 history API and listens to popstate events. Supports use of hash in URL, but session history is still required: deciding to use a hash or not is therefore not a decision based on browser support, but rather a decision based on server capabilities!
Guides
- Configuring routes
- Router options
- Path syntax
- Navigation
- Preventing navigation
- Middleware functions
- Transition
- Using plugins
- Universal applications
API
Examples
Integration
Contributing
Please read contributing guidelines.