My requirement is to perform reactive form field validations in such a way that the error messages are displayed only after the user stops typing.
How can I accomplish this using reactive forms and Rxjs debounceTime?
I'm looking for a solution that works with Reactive forms
The (or at least a) way to get this to work is to dynamically remove and add your validators as you go.
On your input(s), use a
keydown
binding that will strip away validators when the user starts to type, and akeyup
binding that will run through a debounceTime pipe and then reapply the validators (but only after the specified debounce time has passed).Code here:
And StackBlitz here: https://stackblitz.com/edit/debounce-validator