0
angular.element('#number_of_uses').on('keypress' ,function(e){
      alert(e)
    })

can I do something like this? I did not get any error with above code. Hmm want to make sure the input equal to one if the it is empty.

Jessie Emerson
  • 743
  • 4
  • 12
  • 25
  • It would be better to use the Angular directives instead of the jQuery Lite stuff. So use `ng-keypress` on your `number_of_uses` input. – Lex Dec 14 '16 at 17:10
  • @Lex this simple thing I do not want to use directive. – Jessie Emerson Dec 14 '16 at 17:13
  • Angular 1.x is all about using directives. `ng-model` is a directive. `ng-click` is a directive. `ng-keypress` is much more simple than the `angular.element` approach you are taking. – Lex Dec 14 '16 at 17:16

0 Answers0