Despite my thorough search, I couldn't find a solution to my problem of deleting the CORRECT row from the list.
Let's say I have the following array:
$scope.rows = [{
"ID": 12,
"customer": "abc",
"image": "abc.jpg",
},{
"ID": 13,
"customer": "klm",
"image": "klm.jpg",
},{
"ID": 14,
"customer": "xyz",
"image": "xyz.jpg",
}];
I'm attempting to delete the row with ID = 13 (the ID will be received from the server) using the following code:
Socket.on('delete', function( ID ) {
var index = $scope.rows.findIndex(item => item.ID === ID);
$scope.rows.splice(index, 1);
});
However, this doesn't actually remove the correct row.
How can I specify the parameter to correctly delete the desired row like this:
remove rows("ID" = ID)