I have this edit function. Only the select element does not update the value
invoice-update.component.ts
onUpdate(invoice) {
console.log(invoice.customer)
const control = <FormArray>this.form.controls['purchases'];
control.controls = [];
this.form.controls['$key'].setValue(invoice.$key);
this.form.controls['customer'].setValue(invoice.customer);//this is the problem
for (let i in invoice.purchases) {
const product = (invoice.purchases[i].product);
const quantity = (invoice.purchases[i].quantity);
this.addPurchase(product);
control.at(+i).get('quantity').setValue(quantity);
}
}
Although the value is set in the select element, it does not allow updating the value, because it expects an array