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


TypeScript AlertController.create方法代码示例

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


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

示例1: confirm

 /**
  * Opens a modal to ask if the user is sure of something
  * @param question The delete question
  * @param on_confirmed The on confirmed callback
  * @param on_cancel The on cancel callback
  */
 public confirm(question: string, on_confirmed: Function, on_cancel?: Function): void {
     let alert = this.alert_controller.create({
         title: 'Warning',
         message: question,
         buttons: [
             {
                 text: 'Continue',
                 handler: typeof (on_confirmed) === 'function' ? on_confirmed : () => { }
             },
             {
                 text: 'Cancel',
                 role: 'cancel',
                 handler: typeof (on_cancel) === 'function' ? on_cancel : () => { }
             }
         ]
     } as AlertOptions);
     alert.present();
 }
开发者ID:dtaalbers,项目名称:ionic-2-examples,代码行数:24,代码来源:DialogService.ts

示例2: onTempOrdersCanceled

 onTempOrdersCanceled() {
   // if there are open temp orders -> ask user
   if (this.orderService.getTempOrdersByArea(this.area).length > 0) {
     let confirm = this.alertController.create({
       title: this.translationService.getTranslation('ATTENTION'),
       message: this.translationService.getTranslation('OPEN_TEMP_ORDERS_WARNING'),
       buttons: [
         { text: this.translationService.getTranslation('YES'),
           handler: () => { this.nav.popToRoot(); }
         },
         { text: this.translationService.getTranslation('NO') }
       ]
     });
     confirm.present();
   } else {
     this.nav.popToRoot();
   }
 }
开发者ID:manueltaber,项目名称:openorder24,代码行数:18,代码来源:item-selection.ts

示例3: takeMeHome

 takeMeHome():void{
   if( !this.latitude ||!this.longitude){
     let alert = this.alertCtrl.create({
       title : 'Nowhere to go!',
       subTitle : 'You need to set your camp location first.For now, want to launch Maps to find your own way home?',
       buttons:['Ok']
     });
     alert.present();
   }else{
     let destination =  this.latitude+','+this.longitude;
     if( this.platform.is('ios')){
       window.open('maps://?q='+destination+"_system");
     }else{
       let label = encodeURI('My Campsite');
       window.open("geo:0,0?q="+destination+"("+label+")","_system");
     }
   }
 }
开发者ID:qwb0920,项目名称:build_ionic2_app_chinese,代码行数:18,代码来源:location.ts

示例4: constraintTask

 public constraintTask(task: any): void {
   let alert: any = this.alertCtrl.create();
   alert.setTitle('Task Constrained?');
   alert.addInput({ type: 'checkbox', label: 'Constraint Check OK',
                   value: true, checked: task.constraints});
   alert.addButton('Cancel');
   alert.addButton({
     text   : 'Save',
     handler: data => {
       if (data[0] === true) {
         this.task.constraints = true;
       } else {
         this.task.constraints = false;
       }
       this.taskService.updateD();
     },
   });
   alert.present();
 }
开发者ID:apollo-ng,项目名称:governess,代码行数:19,代码来源:task.detail.ts

示例5: doCleanCache

 doCleanCache() {
   let confirm = this.alertCtrl.create({
     title: this.translate.instant('CACHE_CLEAR'),
     message: this.translate.instant('CACHE_CLEAR_PROMPT'),
     buttons: [
       {
         text: this.translate.instant('CANCEL')
       },
       {
         text: this.translate.instant('OK'),
         handler: () => {
           this.store.dispatch(cleanCache());
           this.toast.show(this.translate.instant('CACHE_CLEARED'));
         }
       }
     ]
   });
   confirm.present();
 }
开发者ID:pinkasey,项目名称:activegan,代码行数:19,代码来源:params.ts

示例6:

        this.translate.get(['app.message.' + level + '.title', 'app.action.yes', 'app.action.no']).subscribe(message => {
            let title = message['app.message.' + level + '.title'];
            let yes = message['app.action.yes'];
            let no = message['app.action.no'];

            let alert = this.alertCtrl.create({
                title: title,
                subTitle: content,
                buttons: [{
                    text: yes,
                    handler: okHandler
                },
                    {
                        text: no,
                        handler: noHandler
                    }]
            });
            alert.present();
        });
开发者ID:intasect,项目名称:intalinx-mobile,代码行数:19,代码来源:alertutil.ts

示例7: expeditionMenu

  expeditionMenu()
  {
       let alert = this.alerCtrl.create();
    alert.setTitle('Expedition');

    alert.addInput({
      type: 'radio',
      label: 'Expedition 1 | dur: 10',
      value: '1',
      checked: false
    });
    alert.addInput({
      type: 'radio',
      label: 'Expedition 2 | dur: 30',
      value: '2',
      checked: false
    });
    alert.addInput({
      type: 'radio',
      label: 'Expedition 3 | dur: 50',
      value: '3',
      checked: false
    });
    alert.addInput({
      type: 'radio',
      label: 'Expedition 4 | dur: 70',
      value: '4',
      checked: false
    });
    alert.addButton('Cancel');
    alert.addButton({
      text: 'Ok',
      handler: data => {
        console.log('Radio data:', data);
        this.testRadioOpen = false;
        this.testRadioResult = data;
      }
    });

    alert.present().then(() => {
      this.testRadioOpen = true;
    });
  }
开发者ID:Guigeekun,项目名称:moonwalker,代码行数:43,代码来源:main.ts

示例8: 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

示例9: setTimeout

      setTimeout(() => {
        if (Network.connection == Connection.NONE) {
          console.log("You need internet connection to be able to run this application, please connect to internet and try again.");
          let alert = this.alertController.create({
            title: 'Opps!',
            subTitle: "You need internet connection to be able to run this application, please connect to internet and try again.",
            buttons: [{
              text: 'OK',
              role: 'cancel',
              handler: () => {
                this.navController.setRoot(NoInternetPage);
              }
            }]
          });

          alert.present(alert);
          // this.platform.exitApp();

        }
      }, 1000);
开发者ID:davidkirolos,项目名称:RolApp,代码行数:20,代码来源:tabs.ts

示例10: createReminder

  createReminder() {
    if (this.gameForm.invalid) {
      const alert = this.alertCtrl.create({
        title: 'Invalid Input',
        subTitle: 'You have to set game info to create reminder.',
        buttons: ['OK']
      });
      alert.present();
    } else {
      const values = this.gameForm.value;
      let gameInfo: any = {};
      gameInfo.player = this.report.player.name;
      gameInfo.opponent = values.opponent;
      gameInfo.competition = values.competition;
      gameInfo.date = moment(values.date + ' ' + values.time, 'DD.MM.YYYY. HH:mm');
      console.log(gameInfo);
      this.addEvent(gameInfo);

    }
  }
开发者ID:ilijapavlovic95,项目名称:bescout,代码行数:20,代码来源:game-reminder.ts

示例11:

 this.translateService.get(['areYouSure', 'resetListInfo', 'accept', 'cancel'], {}).subscribe((texts) => {
   let confirm = this.alertCtrl.create({
     title: texts['areYouSure'],
     message: texts['resetListInfo'],
     buttons: [
       {
         text: texts['cancel'],
         handler: () => {
         }
       },
       {
         text: texts['accept'],
         handler: () => {
           this.resetDB();
         }
       }
     ]
   });
   confirm.present();
 });
开发者ID:Ismaestro,项目名称:Packing-Up,代码行数:20,代码来源:preferences.component.ts

示例12:

    this.storage.get("user").then((res) => {
      if (res.user) {
        this.navCtrl.push(NodeCommentPage, {


          userId: res.user._id,
          toUser:toUser,
          note:this.note,

        }
        );
      } else {
        let alert = this.alertCtrl.create({
          title: 'error',
          subTitle: 'auth error ,please relogin!',
          buttons: ['OK'],
        });
        alert.present();
      }
    }).catch((error: Error) => {
开发者ID:classOnline,项目名称:classOnline,代码行数:20,代码来源:CommentListPage.ts

示例13: presentAlert

presentAlert() {
  const alert = this.alertCtrl.create({
    title: 'Smart Stock Update',
    subTitle: 'You are running low on an item',
    buttons: [{text:'Update My List',
    handler: () => {
      console.log("placeholder")
      // this.restService.updateSSQuantity().then(res =>{
      //   console.log(res);
      // })
    }},
    {text:'Restock on Amazon',
    handler: () => {
      window.open("https://www.amazon.com/gp/cart/aws-merge.html?cart-id=133-8971498-2032938&associate-id=123402bb-20&hmac=uztkD9ycMp52gsM%2FIqAIFA9rscQ%3D&SubscriptionId=AKIAJONRAXIF4HTX73DQ&MergeCart=False",'_system', 'location=yes');

    }},
    'Don\'t Update']
  });
  alert.present();
}
开发者ID:jessiejane,项目名称:SimpleLiving,代码行数:20,代码来源:home.ts

示例14: themeAlert

 themeAlert() {
   let alert = this.alertCtrl.create();
   alert.setSubTitle('Choose A Theme');
   for (let theme in PREFERENCES.THEME) {
     alert.addInput({
       type: 'radio',
       label: `${PREFERENCES.THEME[theme]}`,
       value: PREFERENCES.THEME[theme],
       checked: this.themeVal === PREFERENCES.THEME[theme] ? true: false
     });
   }
   alert.addButton('Cancel');
   alert.addButton({
     text: 'OK',
     handler: data => {
       this.store.dispatch(new PrefActions.ChangeTheme(data));
     }
   });
   alert.present();
 }
开发者ID:Margorah,项目名称:CharSheetNg2,代码行数:20,代码来源:preferences.ts

示例15: search

  private search(): void {

    let prompt = this.alertCtrl.create({
      title: 'Search',
      message: "Enter a genre, artist or anything!",
      inputs: [
        {
          name: 'term',
          placeholder: 'Tame Impala'
        },
      ],
      buttons: [
        {
          text: 'Cancel',
          handler: data => {
            console.log('Cancel clicked');
          }
        },
        {
          text: 'search',
          handler: data => {
            console.log('Saved clicked');

            let loading = this.loadCtrl.create({
              content: "Getting songs..."
            });

            loading.present().then(() => {
              this.musicService.getFirstTracks(data.term).then((tracks) => {
                this.songs = tracks;
                loading.dismiss();
              });
            });

          }
        }
      ]
    });

    prompt.present();
  }
开发者ID:jgw96,项目名称:Soundel,代码行数:41,代码来源:home.ts


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