Relative Content

Tag Archive for angularvalidationangular-reactive-formsprimeng

How to change the way PrimeNG displays errors after validation?

In PrimeNG’s documentation, for most input components, it is reported that errors are displayed based on the classes ‘ng-dirty’ and ‘ng-invalid’. However I don’t like that behaviour. It means that the validation is going to be aggressive as soon as the first character is inserted. There are some other styles that prevent the actual input from becoming highlighted red while it is focused, but when using something like a floatLabel, it instantly becomes red as soon as I start inputting text. I’d like for the errors to be shown only on inputs that are already touched, so unfocused, and I’d also like the errors to be shown if I try to submit the form without interacting with a required field.