From 87e8d1f63efb96603c5ab5c05ec28f874336b523 Mon Sep 17 00:00:00 2001 From: Dang Nguyen Anh Khoa Date: Fri, 13 Sep 2013 18:36:27 +0800 Subject: [PATCH] Update http.js documentation for $http not making 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. --- src/ng/http.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/ng/http.js b/src/ng/http.js index 443daf83a696..ea74f85bc255 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 *