I am a bit new to angular 4. I am trying to get change event from an input field inside a directive. Currently i am working with @HostListener
@HostListener('keyup', ['$event'])
inputChanged(event) {}
This is working correctly but this event is fired after some delay from releasing key and user can enter wrong input and is able to see that too. In my implementation i have removed the invalid input but it doesn't give a good exposure to user. Only thing i want is to get change event right the moment change happen in input field (character / string enter or remove both ). Current HTML looks like this
<input type='text' class="form-control" placeHolder='hh:mm:ss' time-input [(ngModel)]="params.time" name="time"/>
PS. time-input is the name of directive and in directive i am trying to get the event change and i don't want to move any implementation to controller or component.
ngModeldirective? - Max Koretskyiinputevent for the DOM native element. Gunter's solution will only work if there'sngModeldirective on theinput. So yourtime-inputwill only work alongsidengModel, it can't be used as a standalone directive - Max Koretskyi