Errors and redirections
When failing a transition function (canActivate, canDeactivate, middleware) custom errors can be returned. Custom errors can be a string or an object and will be added to the error object and passed to start
and navigate
callbacks).
Custom errors
Custom errors can be a string (error code) or an object. They can be passed using the first argument of done
callbacks or encapsulated in failed promises.
A string
An object
Redirecting after an error
When you fail a transition, you can pass a redirect
property to specify what the router should do next. redirect
must be an object containing the route name you want to redirect to (name
) and optionally can contain params (params
).
Last updated