I know that you can use the valueChanges observable in Angular Reactive Forms to detect if a value in the input field has already changed:
inputControl.valueChanges.subscribe(() => {
// fires when the input value has actually changed
});
However, is there a way to subscribe to an observable of when the user has pressed a key, before the value changes in the input?
I need to do this so I can apply dynamic validation, for example:
- User presses a key
- I need to know what that key is before I apply validation
- Validation then works on the changed value of the input