I have below code
(this.formGroups.get('items') as FormArray).controls.forEach((item, index, object) => {
console.log(item.value.attributeDisplayName);
if (item.value.attributeDisplayName === '') {
object.splice(index, 1);
}
});
I am not sure whether the code is correct or not, however it is not getting executed. Basically I need to remove all the object(s)/formGroup(s) from my formGroups array where attributeDisplayName is empty.
item.value gives me the current object with properties where attributeDisplayName resides. Please suggest. Thanks.