mirror of
https://github.com/zhigang1992/angular.js.git
synced 2026-04-17 22:34:43 +08:00
feat($http): allow interceptors to be services
This commit is contained in:
@@ -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
Reference in New Issue
Block a user