Answer the question
In order to leave comments, you need to log in
How to fill a form consisting of formArray?
There is a form which consists of formArray. I am unable to populate it with values. Please tell me how to do it. Here is my attempt:
const f = this.form.get('loadingPlaces') as FormArray;
f.push({
fio: data.fio,
phoneNumber: data.phoneNumber,
});
ERROR TypeError: ctrl.updateValueAndValidity is not a function
Answer the question
In order to leave comments, you need to log in
public form = new FormArray([]);
public fio = new FormControl(data.fio);
public phoneNumber = new FormControl(data.phoneNumber);
ngOnInit() {
this.form.push(this.fio);
this.form.push(this.phoneNumber);
}
https://netbasal.com/angular-reactive-forms-the-ul...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question