I am trying to remove an array element from an formArray in angular reactive form as i dont want to display empty array element. I need to remove the element whose all controls contain null value or false. I dont want to remove the element even if any of its control contains a value other that the once specified.
this.accounts is formArray. I am trying to use the object.keys but not able to retrieve the element that does not contain values
I have tried something below. Could you
if(this.readonly) {
for (const control of this.accounts.controls) {
const result = Object.keys(control).find((key) => (control[key] != null || true));
if(!result) {
// this.accounts.controls.splice();
}
}
}