-
Notifications
You must be signed in to change notification settings - Fork 27.4k
Add invokeApply option to $http #2049
Comments
As part of our effort to clean out old issues, this issue is being automatically closed since it has been inactivite for over two months. Please try the newest versions of Angular ( Thanks! |
I still think that adding an invokeApply option to $http would be valuable. |
Makes sense to me. |
This should be a pretty low impact change, would it open for a pull request? We could simply add a new option |
+1 |
this is not so simple. http is fundamentally based on promises and angular's promises are made asynchronous via $digest queue, so making an $http call that doesn't cause $digest would require the http promise to use some other async queue mechanism (e.g. setTimeout, or something better). I doubt that this will happen in 1.3 as it is a pretty big change. |
+1 |
+1 - would be a great feature to leverage in logging frameworks, etc |
+1 |
@caitp : Now that we have |
Sure |
+1 from me, I consider it a very useful feature. There are scenarios when you have many isolated business components/directives on the page that make many $http calls, some of those request promises get aggregated, developer needs to be in control of promise callbacks triggering $scope.$apply() and maybe do it only once at the very last promise resolution. |
+1 from me as well. |
I'm having some success by directly calling |
See #12557 |
This would be an awesome feature for large applications that use multiple pooling ajax calls. Big +1. @IgorMinar : we may let the user debounce several ajax calls and have him manually trigger the $digest via $evalAsync/$timeout --- it's the whole point of avoiding the $apply no? Can we get this merged soon? |
I agree, this is not just for polling, it's relevant for many http requests scenarios. There are already pull requests so what's keeping it outside of the master? |
I need this, too.... |
+1 As a side question: @dragosrususv why should we avoid |
$timeout has the 'invokeApply' option that allows you to skip dirty checking. It would be very handy to have this option on $http as well.
Why: My application has a periodic $http request to look for updates on the server. 99% of the time there are no updates. It would be more efficient if angular could not run through the entire apply() loop in these cases, which can cause performance issues if the page has lots of bindings. I am getting around this right now by using jquery ajax and calling apply() myself, but I would prefer to use angular's $http.
The text was updated successfully, but these errors were encountered: