本文整理汇总了TypeScript中ionic-angular.AlertController.present方法的典型用法代码示例。如果您正苦于以下问题:TypeScript AlertController.present方法的具体用法?TypeScript AlertController.present怎么用?TypeScript AlertController.present使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ionic-angular.AlertController
的用法示例。
在下文中一共展示了AlertController.present方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1:
},error => {
let alert = this.alert.create({
title: 'Warning',
subTitle: 'Wrong Username or Password! Please Try Again !',
buttons: ['OK']
});
alert.present();
});
示例2: showAlert
showAlert(message) {
let alert = this.alert.create({
title: 'Error',
subTitle: message,
buttons: ['OK']
});
alert.present();
}
示例3: openAlert
openAlert() {
let alert = this.alert.create({
title: 'New Friend!',
subTitle: 'Your friend, Obi wan Kenobi, just accepted your friend request!',
buttons: ['OK']
});
alert.present();
alert.onDidDismiss(() => {
let toast = this.toast.create({
message: 'You closed an alert',
duration: 3000,
});
toast.present();
});
}
示例4:
this.api.doLogin().then((data: any) => {
if (!data.email) {
let alert = this.alert.create({
title: 'Error ' + data.status,
subTitle: data._body,
buttons: ['OK']
});
loading.dismiss();
alert.present();
return;
}
this.api.setData(this.api.data.username, this.api.data.password, this.api.data.url);
this.api.user = data;
this.api.saveUser(data);
loading.dismiss();
this.navCtrl.setRoot(Page1);
}).catch((err) => {
示例5: handleResponse
handleResponse(response){
let alert = null;
if(!!response["enterprise"]){
this.enterprise = response["enterprise"];
if(this.mode == "create")
this.enterprises.push(this.enterprise);
alert = this.alert.create({
title: "Success!",
subTitle: `New enterprise ${this.mode}d!`,
buttons: ["Ok"]
});
} else {
if(!!response["errors"])
this.errors = response["errors"];
alert = this.alert.create({
title: response["statusText"],
subTitle: `Couldn't ${this.mode} the enterprise at the moment.`,
buttons: ["Dismiss"]
});
}
alert.present();
}