we are creating FormGroup as following.
userForm = new FormGroup({
name: new FormControl(),
age: new FormControl()
});
1. Using setValue()
this.userForm.setValue({name: 'Mahesh', age: '20' });
It is necessary to mention all from controls in setValue() otherwise it will throw error.
2. Using patchValue()
this.userForm.patchValue({name: 'Mahesh'});
When we use patchValue() then it is not necessary to mention all form controls.