我在从ReactiveForm中删除FormArray时遇到了问题.
我有以下代码:
ngOnInit() { this.survey = new FormGroup({ surveyName: new FormControl(''),sections: new FormArray([ this.initSection(),]),}); } initSection(){ return new FormGroup({ sectionTitle : new FormControl(''),sectionDescription : new FormControl(''),}); } addSection(){ const control = <FormArray>this.survey.controls['sections']; control.push(this.initSection()); }
现在我要删除formControl surveyName
this.survey.removeControl('surveyName');