Delete an ion-item from typescript


Hi there! I would just like to ask if someone has a solution: “How do I delete a specific ion-item from my script”.
Actually I’m on ionic 3 with typescript as script language.

The real purpose is that I have a page that displays a list of appointments, then when there’s click on one of the items, another page opens displaying the details of it with a cancel button that returns the view to the appointment list page while deleting the appointment item that corresponds to the one that was canceled.

Thanks a lot.



Why you don’t you apply the principle of single responsibility?

The cancel button in the detail view is made to close the details view

and create a new button to delete the appointment from the appointements list.

It is not a god practice to couple two feature in the same btn action.

you could a a feature to mark an appointment that has been already view.


You have several options. Either move the array with appointments in a service, inject that into the view where you have your list and into detail page. From there it’s easy just using .splice(indexOfAppointment, -1). Or you could make use of Events, in your list page subscribe to an event which would get index of deleted appointment and delete it after cancel button published the event. Another thing you could do is make the detail page into a modal and pass it as dismiss data.