本文整理匯總了TypeScript中ionic-angular/components/alert/alert-controller.AlertController.create方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript AlertController.create方法的具體用法?TypeScript AlertController.create怎麽用?TypeScript AlertController.create使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類ionic-angular/components/alert/alert-controller.AlertController
的用法示例。
在下文中一共展示了AlertController.create方法的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();
}