I keep getting errors after using $apply, please answer
漂亮男人2017-05-15 16:56:08
This error is Digest Already In Progress
。原因在于$digest
循环已经在执行了,你再次手动调用了$apply
function.
Just remove the redundant call, you can also $apply
时判断是否已经在$digest
:
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...