本文整理汇总了TypeScript中ionic-angular/components/alert/alert-controller.AlertController类的典型用法代码示例。如果您正苦于以下问题:TypeScript AlertController类的具体用法?TypeScript AlertController怎么用?TypeScript AlertController使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了AlertController类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: showSuccessAlert
public showSuccessAlert(message: string): void {
let successAlert = this._alertCtrl.create({
buttons: ["Ok"],
message: message,
enableBackdropDismiss: false,
title: "Success!"
});
successAlert.present();
}
示例2: showErrorAlert
public showErrorAlert(message: string): void {
let errorAlert = this._alertCtrl.create({
buttons: ["Ok"],
message: message,
enableBackdropDismiss: false,
title: "Error!",
subTitle: "An error occurred"
});
errorAlert.present();
}
示例3: showPrompt
public showPrompt(message: string, confirmHandler: (value: any) => boolean | void, cancelHandler: (value: any) => boolean | void): void {
let promptAlert = this._alertCtrl.create({
buttons: [{
role: "confirm",
handler: confirmHandler,
text: "Confirm"
}, {
role: "cancel",
handler: cancelHandler,
text: "Cancel"
}],
message: message,
enableBackdropDismiss: false,
title: "Please confirm your action"
});
promptAlert.present();
}