When is it safe to use $scope.$apply()?

前端 未结 7 1757
执笔经年
执笔经年 2020-12-09 17:47

I guess the title is pretty much clear what I am asking. I have created this fiddle : http://jsfiddle.net/Sourabh_/HB7LU/13142/

In the fiddle I have tried to replica

7条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-09 18:36

    A better way is to use $scope.$applyAsync(); instead of $scope.$apply();

    The reason to avoid use of $scope.$apply() is given here:

    Error: [$rootScope:inprog] digest in progress. Fix

提交回复
热议问题