I am trying to merge two array objects to achieve a specific structure, similar to the example below.
"feedBackList" : [
{
"questionNo" : 1,
"scoring" : "5"
},
{
"questionNo" : 2,
"scoring" : "5"
},
{
"questionNo" : 3,
"scoring" : "5"
},
{
"questionNo" : 4,
"scoring" : "4"
},
{
"questionNo" : 5,
"scoring" : "Under 25"
}
]
Unfortunately, my current implementation is not working as expected. The resulting structure looks different from what I intended. Can you please advise on how to fix this issue?
https://i.sstatic.net/qkLwn.png
This is the code snippet for reference:
Component
quesNo = [
{questionNo: 1},
{questionNo: 2},
{questionNo: 3},
{questionNo: 4},
{questionNo: 5}
];
newFeedback(): FormGroup {
return this.fb.group({
questionNo: this.quesNo,
scoring: ['']
})
}
onSubmit() {
console.log(this.feedbackForm.value);
}
Please refer to the demo link for further details: https://stackblitz.com/edit/angular-forms-formarray-example-zb634f