Tried to delete multiple object from an array by selecting the checkbox table row. But in my code only 1 item is deleted. Not able to delete multiple selection object. How to resolve this issue?
app.component.ts:
removeSelectedRow() {
this.data2.forEach((value, index) => {
console.log(value);
if (value.isSelected === true) {
this.data2.splice(index, 1);
}
});
}
You can use
Array.filter
andArray.Includes
archieve the result you need. Refer the below code for more reference: