Circular dependency in interceptors
See original GitHub issueI am having this exact same issue: https://github.com/alexcrack/angular-ui-notification/issues/29
I tried the code and I did not have any success.
angular.module('ui', [])
.config(function($httpProvider) {
$httpProvider.interceptors.push('baseHttpInterceptor');
})
.factory('baseHttpInterceptor', function ($injector) {
var Notification = $injector.get('Notification');
return {
'responseError': function() {
Notification.error('Oops');
}
};
});
Circular dependency error:
Circular dependency found:
$compile <- Notification <- baseHttpInterceptor <- $http <- $templateRequest <- $compile
Any ideas?
Issue Analytics
- State:
- Created 8 years ago
- Comments:5 (1 by maintainers)
Top Results From Across the Web
Angular Circular dependency when inject TranslateService to ...
This causes a cyclic dependency since your interceptor needs the TranslateService . You can workaround this by injecting the Injector in ...
Read more >Cyclic dependency error with HttpInterceptor #18224 - GitHub
@perusopersonale that stack overflow error means that your circular dependency has been resolved at build time but is still very much present at ......
Read more >Circular Dependencies in Angular and the Injector Service
A real-world circular dependency. Enter HTTP interceptors. Interceptors are Angular's very handy tool for handling cross-app concerns when it ...
Read more >Package de.hybris.platform.b2ctelcoservices.interceptors
Validation Interceptor making sure that no circular dependency can be formed within a give composite Item. BpoCircularDependencyValidationInterceptor.
Read more >AngularJS: Injecting service into a HTTP interceptor (Circular ...
JavaScript : AngularJS: Injecting service into a HTTP interceptor ( Circular dependency ) [ Gift : Animated Search Engine ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I have just had the same problem. The issue arises that inside of “Notification” there is a dependency on
$http
and$templateCache
.What I have done and which seems to work is to delay the construction of
Notification
until it’s needed in the interceptor.I think it wasn’t the ui-notification’s error. It’s because angular’s injector cannot correctly inject some services to interceptors. I’ve seen this trouble using another modules. So, I’m closing issue.