// setup the form
const formGroup = {};
for (const prop of Object.keys(this.dataObject)) {
try {
const cpv = this.dataObject[prop].cpv;
const value = this.dataObject[prop].value;
formGroup['componentDetails'] = new FormArray([
new FormControl({'cpv': cpv, 'value': value})
]);
} catch (e) {
console.log('Exception in Form setup - ' + e);
}
}
I have the above code to set-up form control and form array for my form. The resulting JSON that is generated does not add value property :(
What I get:
"componentDetails": [
{
"cpv": "CPV_1"
}
]
What I need
"componentDetails": [
{
"cpv": "CPV_1",
"value": "test value"
}
]
I do not see any errors. Was wondering if you anyone faced the same issue and how they solved it?