how to delete multiple rows using checkbox in angular 7

Solutions on MaxInterview for how to delete multiple rows using checkbox in angular 7 by the best coders in the world

showing results for - "how to delete multiple rows using checkbox in angular 7"
Janelle
17 Jan 2020
1You can declare an array to store IDs of selected checkboxes.
2
3SelectedIDs:any[];
4On check of any row you can store id in above array.
5
6selectID(id, event:any){
7    this.SelectedIDs.push(id);
8}
9On click of delete button you can pop up elements with matching ids from array.
10
11deleteSelected(){
12    this.SelectedIDs.forEach(function (obj) {
13    this.pagedItems= this.pagedItems.filter(item=> item.id!== obj.id);
14}
15At the end you will have this.pagedItems without deleted objects.