mirror of
https://github.com/Hopiu/angular.js.git
synced 2026-03-18 23:50:23 +00:00
feat($http): allow interceptors to be services
This commit is contained in:
parent
2986a09c0d
commit
163e05ed36
2 changed files with 623 additions and 584 deletions
|
|
@ -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
Loading…
Reference in a new issue