We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hi,
I'd like to use Notification in my interceptor. It's seams that i can't because there is circular dependency problem:
$http <- Notification <- errorHttpInterceptor <- $http <- $templateRequest <- $compile
This is how i'm registering interceptor:
angular.module('myModule', []) .config(function($httpProvider) { $httpProvider.interceptors.push('errorHttpInterceptor'); }); angular .module('myModule') .factory('errorHttpInterceptor', function (Notification) { return { 'responseError': handleErrorResponse }; function handleErrorResponse(response) { Notification.error('error'); }
Do you have any ideas?
The text was updated successfully, but these errors were encountered:
Yes. I have an idea. Try to use $injector manually. Example:
angular.module('myModule', []) .config(function($httpProvider) { $httpProvider.interceptors.push('errorHttpInterceptor'); }); angular .module('myModule') .factory('errorHttpInterceptor', function ($injector) { var Notification = $injector.get('Notification'); return { 'responseError': handleErrorResponse }; function handleErrorResponse(response) { Notification.error('error'); }
Sorry, something went wrong.
Thank you. It works
No branches or pull requests
Hi,
I'd like to use Notification in my interceptor. It's seams that i can't because there is circular dependency problem:
This is how i'm registering interceptor:
Do you have any ideas?
The text was updated successfully, but these errors were encountered: