I am having an issue with circular dependancy. I built a $http interceptor to handle all $http errors and alert the user with a modal(Angular UI-Bootstrap).
The dependency chain looks like this:
$http <- $modal <- ErrorHandlerService <- HTTPErrorInterceptorService <- $http
The error I am getting is:
Uncaught Error: [$injector:cdep] Circular dependency found: $http <- $modal <- ErrorHandlerService <- HTTPErrorInterceptorService <- $http <- $templateFactory <- $view <- $state
I have read that the trick to getting around these types of issues is to use $injector. I have tried using $injector to inject $modal, I have tried using $injector to inject ErrorHandlerService but I am still getting the Circular dependency error.
Does anybody have any ideas how to get around this?
Thanks!
$httpservice cannot be injected into a$httpinterceptor. I haven't find any way to workaround this, just avoid using$http-dependant stuff in interceptors