AngularJS : Prevent error $digest already in progress when calling $scope.$apply()
Don’t use this pattern – This will end up causing more errors than it solves. Even though you think it fixed something, it didn’t. You can check if a $digest is already in progress by checking $scope.$$phase. $scope.$$phase will return “$digest” or “$apply” if a $digest or $apply is in progress. I believe the difference between these states is that $digest will process the watches of the current scope and … Read more