In my Angular 5 application I would like to override the default validation behaviour of some of my form inputs. In particular, I'd like to immediately trigger the field validation as soon as the user inserts something.
Currently the default behaviour is the following. Assuming that you have, for example, a validator that allows only integers.
Initially the field is pristine and empty:
then the user focus the input and enters some data:
despite the inserted value is not valid (because it's not an integer), the validation is not triggered yet. It will be triggered as soon as the user leaves the focus (for example pressing TAB or focusing another input):
From now on the validation will be triggered at every change.
So if the user goes now back to the field and inserts a valid value, the validator will immediately do its job:
What I would like is to make the validator mark the field as invalid as soon as some non valid data is inserted, even when the user has inserted data for the first time and never left the field yet.