Skip to content
This repository has been archived by the owner on Apr 12, 2024. It is now read-only.

Commit

Permalink
feat($http): allow interceptors to be services
Browse files Browse the repository at this point in the history
  • Loading branch information
IgorMinar committed Dec 6, 2011
1 parent 2986a09 commit 163e05e
Show file tree
Hide file tree
Showing 2 changed files with 530 additions and 491 deletions.
11 changes: 9 additions & 2 deletions src/service/http.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading

0 comments on commit 163e05e

Please sign in to comment.