feat($http): allow interceptors to be services

This commit is contained in:
Igor Minar 2011-12-01 18:54:46 -05:00
parent 2986a09c0d
commit 163e05ed36
2 changed files with 623 additions and 584 deletions

View file

@ -83,11 +83,18 @@ function $HttpProvider() {
var responseInterceptors = this.responseInterceptors = [];
this.$get = ['$httpBackend', '$browser', '$exceptionHandler', '$cacheFactory', '$rootScope', '$q',
function($httpBackend, $browser, $exceptionHandler, $cacheFactory, $rootScope, $q) {
this.$get = ['$httpBackend', '$browser', '$exceptionHandler', '$cacheFactory', '$rootScope', '$q', '$injector',
function($httpBackend, $browser, $exceptionHandler, $cacheFactory, $rootScope, $q, $injector) {
var defaultCache = $cacheFactory('$http');
forEach(responseInterceptors, function(interceptor, index) {
if (isString(interceptor)) {
responseInterceptors[index] = $injector.get(interceptor);
}
});
/**
* @ngdoc function
* @name angular.module.ng.$http

File diff suppressed because it is too large Load diff