I need to set a value in a nested control in a FormBuiler and the model is the following:
this.addAccForm = this.fb.group({
accid: [\'\', Validators.re
Updating nested fields of an Angular FormGroup
looks cleaner using the get
method, like this:
this.addAccForm.get('cyc.det.dcycid').patchValue(9876543);
And if for some reason you like the object syntax:
this.addAccForm.get('cyc.det').patchValue({ dcycid: 9876543 });
nested form patchvalue you need to use Array after object like this:
this.userform.patchvalue({
name: 'Ajay',
approvers: [ {id:1} ]
})