本文整理汇总了TypeScript中ionic-angular.AlertController类的典型用法代码示例。如果您正苦于以下问题:TypeScript AlertController类的具体用法?TypeScript AlertController怎么用?TypeScript AlertController使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了AlertController类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: if
this.sub = this.store.let(getAddPaymentProviderStatus).subscribe((status: ApiRequestStatus) => {
if (status.success && !status.loading) {
// Provider added, navigate to its page
this.viewCtrl.dismiss(provider);
} else if (!status.loading && !status.success && status.error) {
// an error occurred, show dialog
this.alertCtrl.create({
title: this.translate.instant('could_not_authorize'),
message: this.errorService.getErrorMessage(status.error),
buttons: [ this.translate.instant('ok') ]
}).present();
}
});
开发者ID:our-city-app,项目名称:mobicage-payment,代码行数:13,代码来源:add-payment-provider-description-page.component.ts
示例2:
handler401() {
let alert = this.alertCtrl.create({
title: 'Erro 401: Falha de autenticação',
message: 'Email ou senha incorretos',
enableBackdropDismiss: false,
buttons: [
{
text: 'ok'
}
]
});
alert.present();
}
示例3: handlerDefaultError
handlerDefaultError(errorObj) {
let alert = this.alertCtrl.create({
title: 'Erro ' + errorObj.status + ': ' + errorObj.error,
message: errorObj.message,
enableBackdropDismiss: false,
buttons: [
{
text: 'ok'
}
]
});
alert.present();
}
示例4:
this.loading.dismiss().then( () => {
var errorMessage: string = error.message;
let alert = this.alertCtrl.create({
message: errorMessage,
buttons: [
{
text: "Ok",
role: 'cancel'
}
]
});
alert.present();
});
示例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();
}
示例6: logOut
logOut() {
this.alertCtrl.create({
title: '确认退出登陆?',
buttons: [
{ text: '取消' },
{
text: '确定',
handler: () => {
this.events.publish('user:logout', 'logout');
}
}
]
}).present();
}
示例7:
this.local.get(OPTIONS_KEY_NAME).then((res) => {
let options = JSON.parse(res) || {};
if (options.ignoreDuplicateScans && isDuplicate) {
let alert = this.alerts.create({
title: 'Duplicate Entry',
subTitle: 'This scan has been ignored.',
buttons: ['Dismiss']
});
alert.present();
}
else {
this.fetchItem(barcodeData);
}
});
示例8:
}).toPromise().then((res: any) => {
if (res.result == true) {
let alert = this.alertCtrl.create({
title: '',
subTitle: 'success',
buttons: ['OK'],
});
alert.present().then(()=>{
this.navCtrl.pop();
});
}else {
let alert = this.alertCtrl.create({
title: 'sorry',
subTitle: res.des,
buttons: ['OK'],
});
alert.present().then(()=>{
});
}
}).catch(() => {
示例9: presentAlert
presentAlert(title: string, message: string) {
const alert = this.alertCtrl.create(
{
title,
subTitle: message,
buttons: [
{
text: 'OK'
}
]
});
return alert.present();
}
示例10: confirm
confirm(title: string, message: string, handler: (value: any) => boolean | void) {
const alert = this.alertCtrl.create({
title: title,
message: message,
buttons: [{
text: '取消',
role: 'cancel'
}, {
text: '确定',
handler: handler
}]
});
alert.present();
}
示例11: authenticate
/**
* Authentication handler
*/
authenticate() {
let confirm = this.alertCtrl.create({
title: 'Unauthenticated',
message: "Looks like you need new keys. You'll have to log in again!",
buttons: [{
text: 'Login',
handler: () => {
this.redirect();
}
}]
});
confirm.present();
}
示例12: forgotPassword
forgotPassword() {
const prompt = this.alertCtrl.create({
title: this.translateService.instant('RESET_PASSWORD.LINK'),
subTitle: this.translateService.instant('RESET_PASSWORD.SUBTITLE'),
inputs: [
{
name: 'email',
placeholder: this.translateService.instant('RESET_PASSWORD.PLACEHOLDER')
},
],
buttons: [
{
text: this.translateService.instant('Cancel'),
handler: data => {
console.log('Cancel clicked');
}
},
{
text: this.translateService.instant('RESET_PASSWORD.SUBMIT'),
handler: data => {
this.loading = this.loadingCtrl.create({
dismissOnPageChange: true,
});
if (this.isValid(data.email)) {
this.loading.present();
this.authService.forgotPassword(data.email)
.then(
() => {
this.loading.dismiss().then(() => {
this.meuToastService.present(this.translateService.instant('RESET_PASSWORD.SUCCESS'));
});
}
)
.catch(
err => {
this.loading.dismiss().then(() => {
this.meuToastService.present(this.translateService.instant('RESET_PASSWORD.ERROR'));
});
}
);
} else {
this.meuToastService.present(this.translateService.instant('Invalid Email'));
return false;
}
}
}
]
});
prompt.present();
}
示例13: about
// Method to check about
public about(val){
const alert = this.alertCtrl.create({
title: 'About Antibiotic Policy',
message: `
<div> Version v0.0.1 </div><br>
<div> Developed by </div><br>
<span><strong> Raster Images Pvt Ltd </strong></span>
`,
buttons: ['Close']
});
alert.present();
this.selectedTitle = val.target.textContent;
this.viewCtrl.dismiss(this.selectedTitle);
}
示例14: showErrorMessage
showErrorMessage(){
let confirm = this.alert.create({
title: 'Probleem met camera',
message: 'Camera kan niet geopend worden.',
buttons: [
{
text: 'OK',
handler: () => {
console.log('Disagree clicked');
}
}
]
});
confirm.present();
}
示例15: clearSyncInfo
clearSyncInfo() {
let confirm = this.alertController.create({
title: "Forget Dropbox credentials",
message: "Do you really want to clear the Dropbox authentication data?",
buttons: [{
text: "Yes",
handler: () => {
this.settings.removeDropboxAuthInfo();
}
}, {
text: "No"
}]
});
confirm.present();
}