This repository was archived by the owner on Apr 12, 2024. It is now read-only.
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
Why is the call to $apply needed in $http? #13108
Closed
Description
I started to think about it looking at #12557. At first glance the answer is obvious: we need to update the views after we got a response, so we trigger a digest. But hey, it'll be triggered anyway because $http
uses $q
internally. And when a $q
deferred is resolved, it schedules a digest. So can't we just remove that call to $rootScope.$apply
(with all the $applyAsync
thing altogether)? Am I missing something? If it's needed only for the tests, the $apply
call should be moved to $httpBackend.flush
.