Search⌘ K
AI Features

Action Confirmation via Alert

Explore how to enhance mobile app safety by adding delete confirmation alerts using Ionic's ion-alert component. Understand how to implement, customize, and control alert dialogs to ensure users confirm destructive actions before deleting data, improving the app's user interface and experience.

We'll cover the following...

The way the code is currently written, deleting a student from the roster might be done accidentally if the user clicks or taps on the wrong button in the action sheet. There is no warning or confirmation requested. Likewise, when a student is deleted, there is no indication that the action occurred (other than the name disappearing from the list). We will address both of these shortcomings in this lesson.

Delete confirmation

It is inconsiderate for an app to take a destructive action without at least warning the user. It is better to ask for confirmation, and that is what you will do here. In the previous lesson, both of the Delete buttons simply call the deleteStudent function. Instead, ...