Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AngularJS - Do I need $scope.$apply when using $http

Tags:

ajax

angularjs

Do I need to call $scope.$apply when I make an ajax call using $http ?

Looks like it isn't needed because my code still works, and when I used JQuery ajax I needed to call apply or it didnt work.

So just to be completely sure, can I skip the apply calls now?

like image 427
Roger Johansson Avatar asked Jul 05 '13 18:07

Roger Johansson


1 Answers

With AngularJS version 1.1.x you will need to add Scope.$apply if triggering $http calls outside of the AngularJS $digest cycle.

Detailed explanations here: https://stackoverflow.com/a/17271385/1418796

like image 111
pkozlowski.opensource Avatar answered Oct 31 '22 10:10

pkozlowski.opensource