Answers for "how to delete multiple rows using checkbox in angular 7"

0

how to delete multiple rows using checkbox in angular 7

You can declare an array to store IDs of selected checkboxes.

SelectedIDs:any[];
On check of any row you can store id in above array.

selectID(id, event:any){
    this.SelectedIDs.push(id);
}
On click of delete button you can pop up elements with matching ids from array.

deleteSelected(){
    this.SelectedIDs.forEach(function (obj) {
    this.pagedItems= this.pagedItems.filter(item=> item.id!== obj.id);
}
At the end you will have this.pagedItems without deleted objects.
Posted by: Guest on June-28-2021

Code answers related to "how to delete multiple rows using checkbox in angular 7"

Code answers related to "Javascript"

Browse Popular Code Answers by Language