0

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.

comiventor
  • 3,922
  • 5
  • 50
  • 77

1 Answers1

1

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.

Rani Radcliff
  • 4,856
  • 5
  • 33
  • 60