Does anyone have any pointers for me to debounce the keypress event in angular? I can't get it to debounce. And I know for sure because I'm using $log.debug to print out the keys pressed, and the amount of times it fires off is not at the debounce rate.
I have set it up like this:
<div ng-keypress="doSomething"></div>
and in my controller (not that I have included underscore.js to utilize its debounce method in this instance):
...
$scope.doSomething = function(event, keyEvent) {
var keypressed = String.fromCharCode(keyEvent.which).toUpperCase();
_.debounce(handleKeyPress(keypressed), 500);
}
function handleKeyPress(keypressed) {
//do something with the keypress
}
Thanks for your help in advance.