I want to check whether the input is empty.
I tried
To bind functions to events, you don't have to prefix them with on
. Just place the event.
For example, if you want to handle the keydown
(plunker demo):
But in your specific case, since you already are using ngModel
you are better off using (ngModelChange)
:
Because it will pick up the changes when the user pastes (via CTRL+V ormouse right click menu -> Paste) the password instead of typing it.
See plunker demo for using (ngModelChange) here.