I'm trying to do a an array of the child component reactive form. every time I edit in the child (questionForm) it get updated in the parent (adminForm), I have been trying to do this for 2 weeks. so please if you can help I appreciate it I left some related code from what I've been working on
parent.ts
this.adminForm=this.fb.group({
//SurveyName:this.nameForm.getData(),
Questions: this.fb.array([
])
});
get questions() {
return this.adminForm.controls["Questions"] as FormArray;
}
addQuestion() {
//this.questions.push();
}
parent.html
<div *ngFor="let alias of questions.controls; let i=index">
<app-question></app-question>
</div>
<a (click)="addQuestion()">Add question</a>
child.ts
this.questionForm = this.fb.group({
question: [''],
type: ['Checkboxes'],
required: [false],
options: this.fb.array([
this.fb.control('')
])
});