當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。