What is updateValueAndValidity

Max Koretskyi picture Max Koretskyi · Feb 13, 2017 · Viewed 46.9k times · Source

These docs state the following:

If emitEvent is true, this change will cause a valueChanges event on the FormControl to be emitted. This defaults to true (as it falls through to updateValueAndValidity).

What is this updateValueAndValidity?

Answer

Günter Zöchbauer picture Günter Zöchbauer · Feb 13, 2017

You can subscribe to value changes of a control or the whole form.

updateValueAndValidity allows you to modify the value of one or more form controls and the flag allows you to specify if you want this to emit the value to valueChanges subscribers.