Using patchValue() is as easy as typing the following:
form.patchValue({
name: 'chris',
surname: 'noring'
})
For example, if the previous values before calling patchValue() were as follows:
{
name: 'christoffer',
surname: 'n',
age: 36
}
Then applying form.patchValue(), defined earlier, will cause the resulting form to contain the following:
{
name: 'chris',
surname: 'noring',
age: 36
}
Upon closer inspection, we can see that the surname and name have been updated but the age property has been left alone.