Updating Form Groups
Let's see how to use FormGroup to survive through an Internet disconnection so that we don't have to refill the form on reloading.
We'll cover the following
FormGroup
object
Any FormGroup
object has two methods that let us update the value of the form in bulk:
setValue
and patchValue
.
Both take an object and update the value of the form to match the properties of that object.
setValue
method
setValue
is the stricter of the two. The object passed in must exactly map to the object definition passed into form builder (it does not need to be recreated as FormControls
, however). For example:
Get hands-on with 1200+ tech skills courses.