0
I have this formGroup
:
this.formGroup = this.formBuilder.group({
id: [null],
code: [null, Validators.required],
description: [null],
percent: [null, Validators.required],
dueDate: [null, Validators.required],
dataCreate: [null],
couponPlan: this.formBuilder.array([]),
});
}
and need to pass the values to couponPlan initially is just planId
, that I need to get through.
In the submit
form, I’m trying something like:
this.formGroup.value['couponPlan'] = this.formBuilder.group([this.plansids]);
However it does not work, it does not create the couponPlan array.
I’ve tried so many ways this.formGroup.controls['couponPlan'] = this.formBuilder.group([this.plansids]);
It gets the values of planIds wrong. I need to fill in correctly, to receive these values from the list in my API. Look how planId is getting.
It didn’t work, it was the same as in the question.
– Mariana
I’m trying something like
for (let i = 0; i < length; i++) {
 const billInstallment = {}; 
 billInstallment['planId'] = new FormControl(this.selection.selected.map(x=> x.id));
 form.push(new FormGroup(billInstallment));
 }
but it hasn’t worked out yet.– Mariana