Error: $digest already in progress in angularjs when using alert -


i getting json data services in controller.

and using callback function print success message when got loaded. working fine throwing error mentioned in question

//json file { "pc":"name" }  // angular services var service = angular.module('services', ['ngresource']). factory('widgets', function($resource){     return $resource('/json/home.json', {}, {         query: {method:'get', params:{}, isarray:false}     }); });  //controller function editwidget($scope, widgets) {  $scope.data = widgets.query(function(data) {        alert("success data loaded ---> " + json.stringify(data.pc));  }); } 

alert, confirm , prompt pause execution of code (blocks thread), during timeouts , intervals go haywire if should have been triggered during pause. $digest loop made of 2 smaller loops, process $evalasync queue , $watch list. $evalasync queue used schedule work needs occur outside of current stack frame, before browser's view render. done settimeout(0). alert during time causes problem.


Comments

Popular posts from this blog

Eclipse formatter for java ending braces -

ruby - Nesting modules inside of a Rails eninge gem -

php - Why I am getting the Error "Commands out of sync; you can't run this command now" -