Currently, I am trying to remove data from a list but encountering a small issue with the following code.
Component Code
removeSelectedRows(){
console.log(this.selection.selected.map(item => item.userId))
const selectedRowIds = this.selection.selected.map(item => item.userId);
console.log(selectedRowIds)
this.UserService.deleteUser(selectedRowIds).subscribe(res =>{
this.dataSource.data = this.dataSource.data.filter(data => data.userId !== selectedRowIds);
}, err =>{
console.error(err);
}, ()=>{
// this.clearUserForm();
this.loadUsers(this.pageIndex);
});
}
The error arises from this section of the code
this.UserService.deleteUser(selectedRowIds).subscribe(res =>{
this.dataSource.data = this.dataSource.data.filter(data => data.userId !== selectedRowIds)
.
selectRowIds
causing an error
Argument of type 'string[]' is not assignable to parameter of type 'string'