I'm trying to run a function when a model variable updates in my UI but I'm also trying to throttle how often the function is executed via a debounce as the requested function fires an AJAX call. However the debounce function below just doesn't seem to be firing at all.
I originally wrote my own debounce service and have resorted to using underscores debounce method to test whether what I wrote was incorrect or not but it turns out Angular just isn't liking something below...
Using Angular's ng-model-option
debounce method in the HTML is not an option.
$scope.$watch('filters.monthlyCost', function () {
_.debounce(function () {
console.log('lol');
}, 1000);
});
There are no console errors, console.log('lol')
just never happens.
Note: $watch does execute.