diff --git a/src/ng/http.js b/src/ng/http.js index e10207c57f99..f244f8adc49c 100644 --- a/src/ng/http.js +++ b/src/ng/http.js @@ -991,7 +991,7 @@ function $HttpProvider() { } $httpBackend(config.method, url, reqData, done, reqHeaders, config.timeout, - config.withCredentials, config.responseType); + config.withCredentials, config.responseType, notify); } return promise; @@ -1026,6 +1026,14 @@ function $HttpProvider() { } + /** + * Notify callback registered to $httpBackend() + */ + function notify(xhr) { + deferred.notify(xhr); + } + + /** * Resolves the raw $http promise. */ diff --git a/src/ng/httpBackend.js b/src/ng/httpBackend.js index 78d04cfa24b9..3fdc3d298c4b 100644 --- a/src/ng/httpBackend.js +++ b/src/ng/httpBackend.js @@ -40,7 +40,7 @@ function createHttpBackend($browser, createXhr, $browserDefer, callbacks, rawDoc var ABORTED = -1; // TODO(vojta): fix the signature - return function(method, url, post, callback, headers, timeout, withCredentials, responseType) { + return function(method, url, post, callback, headers, timeout, withCredentials, responseType, notify) { var status; $browser.$$incOutstandingRequestCount(); url = url || $browser.url(); @@ -103,6 +103,8 @@ function createHttpBackend($browser, createXhr, $browserDefer, callbacks, rawDoc response, responseHeaders, statusText); + } else if (xhr && xhr.readyState == 3 && notify) { + notify(xhr); } };