I\'m finding that I need to update my page to my scope manually more and more since building an application in angular.
The only way I know of to do this is to call
I have been using this method and it seems to work perfectly fine. This just waits for the time the cycle has finished and then triggers apply()
. Simply call the function apply(
from anywhere you want.
function apply(scope) {
if (!scope.$$phase && !scope.$root.$$phase) {
scope.$apply();
console.log("Scope Apply Done !!");
}
else {
console.log("Scheduling Apply after 200ms digest cycle already in progress");
setTimeout(function() {
apply(scope)
}, 200);
}
}