I'm building a series of input fields that automatically tab when their max length has been reached. This works by checking the length of the value on the ng-keyup event, but this has a slight problem that can be solved by using the oninput event instead. However, this does not seem to be present in Angular?
The problem I'm trying to solve:
When I rapidly enter the max amount of characters (two digits in my case, which can be entered quite fast) the first keyup fires after both characters are entered and tabs to the next field. The second keyup only registers after tabbing, so it fires on the next field. This causes unwanted behavior.
To reproduce check this fiddle (jQuery, because it allows me to quickly reproduce both the problem and solution I'm looking for), fill in the "month" and "year" fields and then rapidly enter 2 digits in the "day" field. When done fast enough, the focus jumps all the way to "year" (because the second keyup was fired while "month" was in focus).
When using .on('input', ...) instead this problem disappears. However, I would like to use this not in jQuery but in Angular as an attribute, like ng-keyup. Is that possible, and if not how could I fix this problem in another way?
.on("input", ...)inside the directive, no?ng-input="myCallback()"-like attribute on an element.