aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDang Nguyen Anh Khoa2013-09-13 18:36:27 +0800
committerPete Bacon Darwin2013-09-13 14:20:14 +0100
commit16c7ab1ba0bd4a206192050be6dd1fe043143f03 (patch)
treee38f53d51fca167075035149ff7e047a94193e6e
parent9ef5d8f31827ba5757ff03fe32fed6757517a36c (diff)
downloadangular.js-16c7ab1ba0bd4a206192050be6dd1fe043143f03.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.
-rw-r--r--src/ng/http.js4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/ng/http.js b/src/ng/http.js
index 85068ff6..df195bd5 100644
--- a/src/ng/http.js
+++ b/src/ng/http.js
@@ -185,6 +185,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
*