I keep getting errors after using $apply, please answer
欢迎选择我的课程,让我们一起见证您的进步~~
This error is Digest Already In Progress。原因在于$digest循环已经在执行了,你再次手动调用了$applyfunction.
Digest Already In Progress
$digest
$apply
Just remove the redundant call, you can also $apply时判断是否已经在$digest:
javascriptif(!$scope.$$phase) { $scope.$apply(); }
javascript
if(!$scope.$$phase) { $scope.$apply(); }
Look at this question: http://stackoverflow.com/questions/12729122/prevent-error-digest-alrea...
If you don’t know what $digest is, refer to this article: http://harttle.github.io/2015/06/06/angular-data-binding-and-digest.ht...
This error is
Digest Already In Progress
。原因在于$digest
循环已经在执行了,你再次手动调用了$apply
function.Just remove the redundant call, you can also
$apply
时判断是否已经在$digest
:Look at this question: http://stackoverflow.com/questions/12729122/prevent-error-digest-alrea...
If you don’t know what
$digest
is, refer to this article:http://harttle.github.io/2015/06/06/angular-data-binding-and-digest.ht...