Configuration options for running validation

Before we move on from validation, there is one more topic to cover and that is configuration options for running the validations. So far, we have been using the default option, which runs validation checks on every input event. However, you have the choice of configuring them to run either on "blur"(that is when the user leaves an input control) or when the form is submitted. You can set this configuration at the form level or on a control-by-control basis.

For example, we might decide that to avoid the complexity of handling missing exercises in the workout form, we will set that form to validate only upon submit. We can set this by adding the following highlighted assignment of NgFormOptions ...

Get Building Large-Scale Web Applications with Angular now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.