typescript IF_04_18_AlertController_TS

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了typescript IF_04_18_AlertController_TS相关的知识,希望对你有一定的参考价值。

import { Component } from '@angular/core';
import { AlertController } from '@ionic/angular';

@Component({
  selector: 'app-home',
  templateUrl: 'home.page.html',
  styleUrls: ['home.page.scss'],
})
export class HomePage {

  constructor(public alertCtrl: AlertController){

  }

  async showAlert(){

    let alert = await this.alertCtrl.create({
      header: "Login",
      subHeader: "Please login to proceed",
      message: "Enter your username and password",
      inputs: [{
        type: 'text',
        name: "username"
      }, {
        type: 'password',
        name: "password"
      }],
      buttons: [{
        text: "Cancel",
        handler: () => {
          // Do nothing
        }
      }, {
        text: "Proceed",
        handler: (formData) => {
          // formData contains the entered username and password
          console.log(formData);
        }
      }]
    });
    alert.present();

  }

}

以上是关于typescript IF_04_18_AlertController_TS的主要内容,如果未能解决你的问题,请参考以下文章

typescript IF_04_20_Actionsheet_TS

typescript IF_04_16_ToastController_TS

typescript IF_04_14_LoadingController_TS

typescript IF_04_10_Checkbox_Binding_2_TS

typescript IF_04_12_Select_Binding_TS

typescript IF_04_08_Checkbox_Binding_TS