diff options
| author | Dang Nguyen Anh Khoa | 2013-09-13 18:36:27 +0800 | 
|---|---|---|
| committer | Pete Bacon Darwin | 2013-09-13 13:41:32 +0100 | 
| commit | b15686cb79c3ccfe44faf2581d8dd787dd8e8961 (patch) | |
| tree | dcf95d341e10bd940205810dff588b8f0a83398f /src/ng | |
| parent | aa3c54c73f7470999535294899a1c33cd193f455 (diff) | |
| download | angular.js-b15686cb79c3ccfe44faf2581d8dd787dd8e8961.tar.bz2 | |
docs($http): explain why $http may not make the request immediately
I came across this issue today and after researching has found out this thread on so:
http://stackoverflow.com/questions/17039998/angular-not-making-http-requests-immediately.
It took me quite sometimes to figure out this so I hope the addition in documentation could save somebody else some times and frustration.
Diffstat (limited to 'src/ng')
| -rw-r--r-- | src/ng/http.js | 4 | 
1 files changed, 4 insertions, 0 deletions
| diff --git a/src/ng/http.js b/src/ng/http.js index 443daf83..ea74f85b 100644 --- a/src/ng/http.js +++ b/src/ng/http.js @@ -221,6 +221,10 @@ function $HttpProvider() {       * will result in the success callback being called. Note that if the response is a redirect,       * XMLHttpRequest will transparently follow it, meaning that the error callback will not be       * called for such responses. +     *  +     * If your $http is scheduled from something that doesn't cause a $digest to fire then your  +     * request won't be sent immediately. To make sure a $http request if fired immediately, wrap your +     * call around with an $scope.$apply(function(){ //make $http request here }       *       * # Shortcut methods       * | 
