Reputation: 4122
Is it a good practice to always update scope variable(s) using $scope.$apply when the control returns from a non-angular event?
I have a use case where same method is used by both angular and non-angular event and I want to avoid code duplication.
Upvotes: 0
Views: 65
Reputation: 5084
You do need to use it if you are going to run code in a new turn. And only if that turn isn’t being created from a method in the AngularJS library. Inside that new turn, you should wrap your code in $scope.$apply().
Take a look at this link.
Upvotes: 1