canActivate
and canDeactivate
functions are now consistent.createRouter
function as opposed to a Router5
class. The API is identical between createRouter(routes, options)
and new Router5(routes, options)
.router5-history
, router5-persistent-params
and router5-listeners
have been moved to router5 main repository. They are no longer individual modules but are distributed with router5 module.useHash
, hashPrefix
and base
options need to be passed to browserPlugin
, not router5buildUrl
, matchUrl
and urlToPath
methods are no longer present by default and are added to your router instance by browserPlugin
.setAdditionalArgs
has been renamed to setDependencies
/ setDependency
and getAdditionalArgs
has been renamed to getDependencies
.toState
in middleware, canActivate and canDeactivate functions. Instead, they are injected alongside router
, and are now available in plugins too. They are passed as an object of key / value pairs: it will now be easier to share code, plugins, middleware without sharing the exact same dependencies.canActivate('admin', isAdmin)
).allowNotFound
option available, to give a new strategy to deal with unkown routes.defaultRoute
option is not supplied and a path cannot be matched by the router, then the router will emit an ROUTE_NOT_FOUND
error unless allowNotFound
is set to true. In that case, the router will allow the transition to happen and will generate a state like the following one (given a User tried to navigate to an unknown URL /route-not-found
):usePlugin
and useMiddleware
behave the same: you can supply one or more argument, and calling them thereafter will add more plugins / middleware functions (useMiddleware
used to overwrite middleware functions)errCodes
has been renamed to errorCodes
navigate
, allowing users to only supply a route name and a done callback (router.navigate('home', () => { /* ... */ })
)setRootNodePath
function has been added to configure the path of the root node. It can be used for example to list a number of allowed query parameters for all routes if strictQueryParams
option is set to true
.