API Reference
Last updated
Last updated
Create a router instance
routes
: your application routes, see
options
: your router options, see
dependencies
: the dependencies you want to make available in middleware and plugins, see
Clone an existing router.
router
: the router instance to clone
dependencies
: the new dependencies, for the cloned router (optional)
Add routes, see
startPathOrState
: a starting path (string) or state (object). When using browserPlugin
, this argument is optional: path will be read from the document location
done
: a done callback (done(err, state)
)
Check if the router is in a started state
Navigate to a new route
routeName
: the name of the route to navigate to
routeParams
: the route params
options
: options for the transition (replace
, reload
, skipTransition
, force
or any custom option)
done
: a done callback (done(err, state)
)
Navigate to the default route (if any)
Stop your router
Cancel the current transition (if any)
Set a route to forward to another route (when navigating to the first one)
Return the current state
Return current options
Set an option
Set a dependency
Set dependencies
Return the current dependencies
Remove all middleware
Remove a canDeactivate
handler for the provided route name
Build a path given a route name and params
Attempt to match a path
Set the root path
Check if the provided route is currently active
name
: the route name
params
: the route params
strictEquality
: whether to check if the given route is the active route, or a descendant of the active route (false
by default)
ignoreQueryParams
: whether to ignore query params (true
by default)
Compare two route state objects
Check if a state is a descendant of another state
The browser plugin adds the following to your router instance:
Build an URL
Match an URL
Replace state in history and silently update your router instance state. Use if you know what you are doing.
Register one or multiple middlewares, see
Register one or multiple plugins, see
Set a canActivate
handler for the provided route name, see
Set a canDeactivate
handler for the provided route name, see
See