javascript - $apply already in progress without using $apply anywhere -
i have following javascript code:
$scope.fav_details = function(id1,id2,bio) { document.getelementbyid(id2).style.display="none"; document.getelementbyid(id1).style.display="block"; $scope.getlegislatordetails(bio); document.getelementbyid(bio).click(); }
the line throwing following error click event above. dont understand did not apply $apply anywhere in code still getting error. can me. getlegislatordetails function in above code has api call , stores data in scope variable. have following angular js error:
angular.js:13642 error: [$rootscope:inprog] http://errors.angularjs.org/1.5.6/$rootscope/inprog?p0=%24apply @ error (native) @ https://ajax.googleapis.com/ajax/libs/angularjs/1.5.6/angular.min.js:6:412 @ n (https://ajax.googleapis.com/ajax/libs/angularjs/1.5.6/angular.min.js:137:381) @ m.$apply (https://ajax.googleapis.com/ajax/libs/angularjs/1.5.6/angular.min.js:145:312) @ htmlbuttonelement.<anonymous> (https://ajax.googleapis.com/ajax/libs/angularjs/1.5.6/angular.min.js:274:247) @ htmlbuttonelement.dispatch (http://localhost/congress/js/jquery-3.1.1.min.js:3:10315) @ htmlbuttonelement.q.handle (http://localhost/congress/js/jquery-3.1.1.min.js:3:8342) @ m.$scope.fav_details (http://localhost/congress/scripts.js:938:38) @ fn (eval @ compile (https://ajax.googleapis.com/ajax/libs/angularjs/1.5.6/angular.min.js:231:126), <anonymous>:4:436) @ b (https://ajax.googleapis.com/ajax/libs/angularjs/1.5.6/angular.min.js:126:19)(anonymous function) @ angular.js:13642 angular.js:13642 error: [$rootscope:inprog] http://errors.angularjs.org/1.5.6/$rootscope/inprog?p0=%24apply @ error (native) @ https://ajax.googleapis.com/ajax/libs/angularjs/1.5.6/angular.min.js:6:412 @ n (https://ajax.googleapis.com/ajax/libs/angularjs/1.5.6/angular.min.js:137:381) @ m.$digest (https://ajax.googleapis.com/ajax/libs/angularjs/1.5.6/angular.min.js:142:30) @ m.$apply (https://ajax.googleapis.com/ajax/libs/angularjs/1.5.6/angular.min.js:145:401) @ htmlbuttonelement.<anonymous> (https://ajax.googleapis.com/ajax/libs/angularjs/1.5.6/angular.min.js:274:247) @ htmlbuttonelement.dispatch (http://localhost/congress/js/jquery-3.1.1.min.js:3:10315) @ htmlbuttonelement.q.handle (http://localhost/congress/js/jquery-3.1.1.min.js:3:8342) @ m.$scope.fav_details (http://localhost/congress/scripts.js:938:38) @ fn (eval @ compile (https://ajax.googleapis.com/ajax/libs/angularjs/1.5.6/angular.min.js:231:126), <anonymous>:4:436)(anonymous function) @ angular.js:13642
the getlegislatordetails function can found in following link:-
https://github.com/anirbanmishra/congress.php/blob/master/getlegislatordetails
in case attached
ng-click=getlegislatordetails
for bio element
then comment line below code
$scope.getlegislatordetails(bio); document.getelementbyid(bio).click();
Comments
Post a Comment