When I select the item from the list, and select save, the item should be removed from the list. I'm able to retrieve the selected item from using this method - form.value.selectedMessages - which gives me an array of the object I selected. The overall number of received messages which is an array is rMessages. What's happening here is both of my messages are being removed and not just the selected one. It's probably something easy that I'm missing. Appreciate it!
save(form){
this.rMessages = this.rMessages.filter(resultTwo => {
form.value.selectedMessages.map(resultOne => {
return resultTwo.messageID !== resultOne.messageID
})
})
}
Data
List of messages --
[{messageID: 1, message: "message One"},
{messageID: 2, message: "message Two"}]
Selected Message or could be both
[{messageID: 1, message: "message One"}]
if One is selected then below should only show
[{messageID: 2, message: "message Two"}]