0
On one of my pages, when the user clicks the button Delete an Alert is displayed requesting confirmation. This action exists on more than one page, to avoid duplicating code, how can I reuse the method below? Should I move somewhere, do some kind of include?
showConfirm(slidingItem: ItemSliding) {
const confirm = this.alertCtrl.create({
title: 'Deletar tarefa!',
message: '<strong>Atenção</strong>: Essa ação não tem como ser desfeita.',
buttons: [
{
text: 'Cancelar',
handler: () => {
slidingItem.close();
}
},
{
text: 'Deletar',
handler: () => {
slidingItem.close();
}
}
]
});
confirm.present();
}
This code is executed by clicking on the element:
<button ion-button color="danger">
<ion-icon name="delete"></ion-icon>
Deletar
</button>