当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript Alert.present方法代码示例

本文整理汇总了TypeScript中ionic-angular.Alert.present方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Alert.present方法的具体用法?TypeScript Alert.present怎么用?TypeScript Alert.present使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ionic-angular.Alert的用法示例。


在下文中一共展示了Alert.present方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: exibirAlertaSimNao

 exibirAlertaSimNao(mensagem: string, funcaoSim: Function = null, funcaoNao: Function = null){
     if(!funcaoSim){
         funcaoSim = function () {return true;};
     }
     if(!funcaoNao){
         funcaoNao = function () {return true;};
     }
     this.alert = this.alertCtrl.create({
         title: 'Atenção',
         message: mensagem,
         buttons:[
             {
                 text: 'Sim',
                 role: 'sim',
                 handler: () => funcaoSim()
             },
             {
                 text: 'Não',
                 role: 'nao',
                 handler: () => funcaoNao()
             }
         ],
         enableBackdropDismiss: false
     });
     this.alert.present();
 }
开发者ID:FredericoGrz,项目名称:MyApp,代码行数:26,代码来源:alert.ts

示例2: alertThatTeamDoesNotExist

 alertThatTeamDoesNotExist(teamName: string): void {
   let alert: Alert = this.alertCtrl.create({
     title: 'Team Does Not Exist!',
     message: 'Would you like to create this team?',
     buttons: [
       {
         text: 'NO'
       },
       {
         text: 'YES',
         handler: () => {
           this.db.createNewTeam(teamName).then((team: Team) => {
             console.log('team-sign-in', 'alertThatTeamDoesNotExist', '>>>', team);
             if (team) this.navCtrl.push(PlayerCreationPage, { teamID: team.teamID, isAdmin: true });
             else {
               alert.dismiss();
               this.alertThatTeamCouldNotBeCreated();
             }
           });
         }
       }
     ]
   });
   alert.present();
 }
开发者ID:ttowncompiled,项目名称:MyTeam,代码行数:25,代码来源:team-sign-in.ts

示例3:

 this._platform.ready().then(() => {
   if (this._alert) {
     this._alert.dismiss();
   }
   this._alert = this._createAlert(updateAlertType);
   if (this._alert) {
     this._alert.present();
   }
 });
开发者ID:bGraphic,项目名称:varsom-hybrid,代码行数:9,代码来源:ui-update-alert.effects.ts

示例4: Promise

 return new Promise((resolve,reject) => {
   let alert: Alert = this.create({
     title: 'แจ้งเตือน',
     subTitle: message, 
     buttons: [
       { 
         text: 'ตกลง',
         handler: () => {
           resolve();
         }
       }
     ]
   });
   alert.present();
   alert.onDidDismiss( ()=> {
     reject('onDidDismiss');
   });
 });
开发者ID:warozz,项目名称:D3VMobiz,代码行数:18,代码来源:alert.ts

示例5: onClick

 /**
  * Called when a HTML element with 'clear-history' directive is clicked. <br/>
  * It opens an dialog which allows the user to clear his navigation history or cancel the operation.
  * @return {void}
  */
 @HostListener('click', ['$event.target'])
 public onClick(): void {
     Analytics.trackEvent('Clear History', 'click', 'button');
     let confirm: Alert = this.ctrl.create({
         title: this.Text.COMPONENT_CLEAR_HISTORY_ALERT_TITLE,
         message: this.Text.COMPONENT_CLEAR_HISTORY_ALERT_MESSAGE,
         buttons: [
             {
                 text: this.Text.COMPONENT_CLEAR_HISTORY_ALERT_BUTTON_NO,
                 handler: (): void => console.log('Clear canceled'),
             },
             {
                 text: this.Text.COMPONENT_CLEAR_HISTORY_ALERT_BUTTON_YES,
                 handler: (): void => this.clearHistory(),
             },
         ],
     });
     confirm.present(confirm);
 }
开发者ID:RioBus,项目名称:ionic,代码行数:24,代码来源:controller.ts

示例6: alertThatTeamAlreadyExists

 alertThatTeamAlreadyExists(teamName: string): void {
   let alert: Alert = this.alertCtrl.create({
     title: 'Team Already Exists!',
     message: 'Would you like to sign in?',
     buttons: [
       {
         text: 'NO'
       },
       {
         text: 'YES',
         handler: () => {
           this.db.checkIfTeamExists(teamName).then((team: Team) => {
             if (team) this.navCtrl.push(PlayerSignInPage, { teamID: team.teamID });
             else this.alertThatCouldNotSignIn();
           });
         }
       }
     ]
   });
   alert.present();
 }
开发者ID:ttowncompiled,项目名称:MyTeam,代码行数:21,代码来源:team-creation.ts

示例7: alertAndDo

export function alertAndDo(
    alertController: AlertController,
    question: string,
    button1Text: string,
    action1: (data: any) => void,
    button2Text?: string,
    action2?: (data: any) => void
): void {
    'use strict';

    console.log('askAndDo(' + question + ')');
    // console.log('question: ' + question);
    // console.log('button1Text: ' + button1Text);
    // console.log('action1: ' + action1);
    // console.log('button2Text: ' + button2Text);
    // console.log('action2: ' + action2);

    let alert: Alert = alertController.create();

    alert.setTitle(question);

    if (!action2) {
        alert.addButton('Cancel');
    }

    alert.addButton({
        text: button1Text,
        handler: action1
    });

    if (action2) {
        alert.addButton({
            text: button2Text,
            handler: action2
        });
        alert.addButton('Cancel');
    }

    alert.present();
}
开发者ID:zhu04303661,项目名称:ionic-recorder,代码行数:40,代码来源:alerts.ts

示例8: loginUser

 async loginUser(): Promise<any> {
   if (!this.loginForm.valid) {
     console.log('Form not ready');
   } else {
     let loading: Loading = this.loadingCtrl.create();
     loading.present();
     const email: string = this.loginForm.value.email;
     const password: string = this.loginForm.value.password;
     try {
       await this.auth.loginUser(email, password);
       await loading.dismiss();
       this.navCtrl.setRoot(TabsPage);
     } catch (error) {
       await loading.dismiss();
       const alert: Alert = this.alertCtrl.create({
         message: error.message,
         buttons: [{ text: 'Ok', role: 'cancel' }]
       });
       alert.present();
     }
   }
 }
开发者ID:liberant,项目名称:lproProducer,代码行数:22,代码来源:login.ts


注:本文中的ionic-angular.Alert.present方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。