2021-12-09

Tech Programing

程式人小天地

voice confirmation on an alert confirm window on Ionic

1 min read


I am trying to confirm not by typing the button but by replying verbally on an alert window. I have already installed alertController and speechRecognition but I don’t know how to make them interact together. This is my code :

presentAlertConfirm() {
   
    this.alertController
      .create({
        header: 'object detection,
        message: 'Are you sure you want to confirm?',
        buttons: [
          {
            text: 'NO',
            role: 'cancel',
            cssClass: 'secondary',
            handler: (data) => {
              this.statusConfirm = 'confirmation canceled';
              
            },
          },
          {
            text: 'SI',
            handler: () => {
              this.statusConfirm = 'confirm OK';
              this.viewObjectDetail;
              
            },
          },
        ],
      })
      .then((confirmElement) => {
        confirmElement.present();
      });
  }



Source link

資料來源:Stackoverflow

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *