I have in such situation as I have to pass data to server like below [1, 2, 454, 5456]
And the data in formArray of FormGroup
I tried to create an empty array and then push empty formControl to that array but that doesn't work
this._fb.group({
content: this._fb.group({
question: [null, Validators.required],
media: [null, Validators.required],
options: this._fb.array([new FormControl(null), new FormControl(null), new FormControl(null), new FormControl(null)]),
correct_answer: [null, Validators.required],
})
});
I want options data like ['1st option', '2nd option'] But I can't able to define formControlName in template. If I define some it tries to find out the property of index of the formArray.
My expected result
['1st option', '2nd option']