Do I need to call $scope.$apply when I make an ajax call using $http ?
我需要调用$scope吗?$apply当我使用$http进行ajax调用时?
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.
看起来不需要它,因为我的代码仍然可以工作,当我使用JQuery ajax时,我需要调用apply或者它不能工作。
So just to be completely sure, can I skip the apply calls now?
为了完全确定,我现在可以跳过apply调用吗?
1 个解决方案
#1
3
With AngularJS version 1.1.x you will need to add Scope.$apply
if triggering $http
calls outside of the AngularJS $digest
cycle.
与AngularJS 1.1版。您需要添加范围。如果在AngularJS $digest循环之外触发$http调用,则应用$。
Detailed explanations here: https://*.com/a/17271385/1418796
详细说明:https://*.com/a/17271385/1418796
#1
3
With AngularJS version 1.1.x you will need to add Scope.$apply
if triggering $http
calls outside of the AngularJS $digest
cycle.
与AngularJS 1.1版。您需要添加范围。如果在AngularJS $digest循环之外触发$http调用,则应用$。
Detailed explanations here: https://*.com/a/17271385/1418796
详细说明:https://*.com/a/17271385/1418796