With every article I publish, my goal is to help you become a better and more confident coder.

Here are a couple of pointers to help shed some light on Angular Forms:

Control Validation

By default, whenever a value of a FormControl changes, Angular runs the control validation process.

For example, if you have an input that is bound to a form control, Angular performs the control validation process for every keystroke.

Let’s see this in action:

Now, imagine a form with complex validation requirements — updating such a form on every keystroke could become too costly. In addition to that, I find it very annoying to display an error message to the user when he hasn’t completed the action of entering the form data.

The way we get around this is by using the updateOn property. We can tell Angular that we only want to run the validation function upon submit or blur . As we saw, the default option is upon change .

updateOn: ‘blur’