Check fiddle:
http://jsfiddle.net/9sqtvcou/1/
Type something in the input and then wait 500ms. If you change the "external resources" to version 1.2.27 (latest v1.2 as from the date I posted this) it works, otherwise it doesn't.
This is the potential relevant code:
var debounceDuration = $parse($attrs.debounce)($scope);
var immediate = !!$parse($attrs.immediate)($scope);
var debouncedValue, pass;
var prevRender = ngModelController.$render.bind(ngModelController);
var commitSoon = debounce(function (viewValue) {
pass = true;
ngModelController.$setViewValue(viewValue);
pass = false;
}, parseInt(debounceDuration, 10), immediate);
ngModelController.$render = function () {
prevRender();
commitSoon.cancel();
//we must be first parser for this to work properly,
//so we have priority 999 so that we unshift into parsers last
debouncedValue = this.$viewValue;
};
ngModelController.$parsers.unshift(function (value) {
if (pass) {
debouncedValue = value;
return value;
} else {
commitSoon(ngModelController.$viewValue);
return debouncedValue;
}
});
I am not familiarized with angular, so I am wondering: what happened that broke angular-debounce in v1.3?
EDIT: An answer with technical details would have priority over abstract ones.
https://github.com/shahata/angular-debounce/issues/12
As angular-debounce creator and angular contributor, shahata said:
debounce is supported natively in angular 1.3 using ng-model-options.
That is why angular-debounce is broken at angular v1.3.