Quantcast
Channel: AngularJS : Prevent error $digest already in progress when calling $scope.$apply() - Stack Overflow
Viewing all articles
Browse latest Browse all 29

Answer by Sachin Mishra for AngularJS : Prevent error $digest already in progress when calling $scope.$apply()

$
0
0

The issue is basically coming when, we are requesting to angular to run the digest cycle even though its in process which is creating issue to angular to understanding. consequence exception in console.
1. It does not have any sense to call scope.$apply() inside the $timeout function because internally it does the same.
2. The code goes with vanilla JavaScript function because its native not angular angular defined i.e. setTimeout
3. To do that you can make use of

if(!scope.$$phase){
scope.$evalAsync(function(){

}); }


Viewing all articles
Browse latest Browse all 29

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>