In my angular application I have a FormArray inside my FormGroup. I get some values which is an array and I need form control to patchValue with the array. When I do that, I see only one value attached to the formArray. Remaning are not set.
I tried to set :
form.controls['mycarsform']?.patchValue(formVal.mycarsform);
form.controls['mycarsform']?.get('mycarsGroup.carArrayGroupForm').patchValue(formVal.mycarsform?.mycarsGroup.carArrayGroupForm);
Below is my formGroup:
mycarsform : formGroup
controls:
mycarsGroup : formGroup
controls :
carArrayGroupForm : FormArray
controls :
formGroup:
controls
invoiceAmt : FormControl
type: FormControl
company : FomrControl
Below is my formVal which has values for carArrayGroupForm
formVal :
mycarsform :
mycarsGroup:
carArrayGroupForm :
[
{ invoiceAmt = '1800.00'
type = 'Benz"
company : 'Bmw'},
{ invoiceAmt '1200.00'
type = 'Hyundai'
company = 'Ford'}
]