$apply already in progress error

You are getting this error because you are calling $apply inside an existing digestion cycle. The big question is: why are you calling $apply? You shouldn’t ever need to call $apply unless you are interfacing from a non-Angular event. The existence of $apply usually means I am doing something wrong (unless, again, the $apply happens from a non-Angular event). If $apply really is appropriate … Read more

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