我想遍历我的表单组,然后确定哪些是有效的,然后将组中的无效添加到一个新数组中。但是,我无法获取每个表单组的名称值。
this.applicationFormArray = new FormGroup({
selectAppFormGroup:this.selectAppFormGroup = new FormGroup({
}),
generalAppFormGroup:this.generalAppFormGroup = new FormGroup({
}),
fileModeFormGroup:this.fileModeFormGroup = new FormGroup({
}),
accessListFormGroup:this.accessListFormGroup = new FormGroup({
})
});
this.applicationFormGroup.addControl('applicationFormArray', this.applicationFormArray);
checkValidity() {
for (let c of Object.getOwnPropertyNames(this.applicationFormArray.controls)) {
if(!this.applicationFormArray.controls[c].valid) {
var invalidFormGroups = new Array;
var grabFormGroups = console.log(this.applicationFormArray.controls[c].get('?????'));
invalidFormGroups.push(grabFormGroups);
}
}
}