Closed adamreisnz closed 6 years ago
The $stateProvider
facade is mostly still there for backwards compatiblity. You can inject the $uiRouterProvider
(or $uiRouter
at runtime) and access all the services through that reference.
.config($uiRouterProvider =>
$uiRouterProvider.stateService.defaultErrorHandler(...)
);
Alright, will use that, thanks
This is a:
My version of UI-Router is: 1.0.10
Feature Request
Make the
[defaultErrorHandler](https://ui-router.github.io/ng1/docs/latest/classes/state.stateservice.html#defaulterrorhandler)
method from StateService accessible in the configuration phase of Angular, so that we can apply custom error handling (like capturing errors with Sentry) in one place.Currently, I need to to it in the config phase for Angular exceptions (using a decorator for
$exceptionHandler
) and then in the run phase for UI-Router, because thedefaultErrorHandler
method is only available on the$state
injectable it seems, and not on any injectables available during the config phase.It'd be great if the
defaultErrorHandler
method could be exposed on for example the$stateProvider
in addition, allowing us to call it from the config phase.