scriptology
11/3/2015 - 4:33 PM

$watch, debounce

$watch, debounce

var filterAction = function(scope) {
  console.log("filterAction");
};

var filterDelayed = function(scope) {
    scope.$apply(function(){filterAction(scope);});
};
var filterThrottled = _.debounce(filterDelayed, 500);
scope.$watch('formData', function(){filterThrottled(scope);}, true);