Good day guys, please I am having issues updating values in a formArray from my angular 6 component. I have tried using setValue() and patchValue() no one of them is working. Below is my code
this.form = this._formBuilder.group({
locationRequests: this._formBuilder.array([
this._formBuilder.group({
location: '',
item_category: '',
items: '',
quantity: '',
packaging: '',
unit_of_measurement: '',
});
])
});
I want to set value to each of the fields from my component, i have tried
this.form.patchValue({
locationRequests: this._formBuilder.array([
this._formBuilder.group({
location: 'New York',
item_category: 2,
items: 1,
quantity: 500,
packaging: 1,
unit_of_measurement: 'PCS',
}
});
I have also tried using setValue function still did not work. I have searched online and all the answers aren't working.