本文整理匯總了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();
}