Reputation: 141
Adding two functions in ng-keydown through the use of jQuery attr
How can I do this the right way.
$('#id').attr('ng-keydown', 'maxinput(), numericOnly()');
Upvotes: 1
Views: 310
Reputation: 21278
I agree with @pixelbits that you should create a custom validator for the purpose you are trying to achieve. In fact, you can even use ng-maxlength and set input type to number
to have the validation you require OOTB.
But if you really want to call multiple functions in an ng-*
handler (it can be click, keydown etc), you should separate calls with semicolon ;
instead of comma.
You might also want to read how to think in Angular way with jQuery background.
Upvotes: 1