Reputation: 4756
In angular.js there is $watch to watch the scoped variables for updates. but is there anything that I can do, such as execute a function until the variable gets updated
Upvotes: 0
Views: 172
Reputation: 15614
watch until value change
var watchVar = $scope.$watch('value', function(newValue , oldValue){
if(newValue!=oldValue){
//value changed remove watch
watchVar();
}
});
Upvotes: 3
Reputation: 488
//try this (please inject $interval service to your controller)
var execueMe = function () {
//your stuff
}
$interval(execueMe, 3000); //will trigger every 3 seconds
Upvotes: 1