How to write a alert controller in providers and return the index

#1

Hi Guys,
I have return confirmation alert. In my program i have to use confirmation alert in multiple time and multiple places. Every page i have to use the code but handler and button text only changed, so i have to written one service and handler and it will return the call back function for the controller.

Ex.

 this.alert = this.alertCtrl.create({
    title: title,
    subTitle: message,
    message: message,
    enableBackdropDismiss: false,
    buttons: [{
    text: "Cancel",
    role: "cancel",
    handler: () => {
        alert("user was cancelled")
    }
    }, {
    text: "OK",
    role: "ok",
    handler: () => {
        alert("user accepted")
    }
    }]

});
this.alert.present();

Thank you guys.

#2

Have you managed to do it ?