An error occurred while fetching folder content.
Andrew Scott
authored
This change aligns the behavior of the error handler in the `ExtraOptions` of `RouterModule.forRoot` with the error handler in `withNavigationErrorHandler`. The changes are: * Slightly different timing: The handler is called before the `NavigationError` emits * Runs in the injection context, meaning it is more configurable at the config location rather than needing to assign the value to the `Router.errorHandler` later to get access to injectables * Can now return `RedirectCommand` to recover from the error and redirect without emitting `NavigationError` * No longer allows arbitrarily overriding return value of the navigation promise BREAKING CHANGE: The `Router.errorHandler` property has been removed. Adding an error handler should be configured in either `withNavigationErrorHandler` with `provideRouter` or the `errorHandler` property in the extra options of `RouterModule.forRoot`. In addition, the error handler cannot be used to change the return value of the router navigation promise or prevent it from rejecting. Instead, if you want to prevent the promise from rejecting, use `resolveNavigationPromiseOnError`. PR Close #57050
Name | Last commit | Last update |
---|