Does not work Angular validation with @ViewChildren parent and multiple child.
In the parent used multiple child componets
@ViewChildren('aaa') pList:QueryList<PComponent>;
Able to get child component values.
But cannot validate. Save button in the parent form. If we check child field values as valid then return false does not apply.
let index1 = 0 ;
@ViewChildren('pDirection') pList:QueryList<PComponent>;
pFormArray.controls.forEach(ele => {
let pList = this.pList.toArray()[index1];
let stationList = pList ["portRotationForm"]["controls"]["stationFormArray"]["controls"];
stationList.forEach(elements => {
if (elements.controls["countryName"].invalid ) {
validForm = false;
}
});
});