html页面

 <button ion-button color="danger" class="button-block button-round-ios" (click)="myAlert()">alert提示</button>

ts代码

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

@Component({
  selector: 'page-home',
  templateUrl: 'home.html'
})
export class HomePage {

  constructor(public navCtrl: NavController,public alertCtrl: AlertController,public toastCtrl: ToastController) {

  }


  myAlert(){
    let myalert=this.alertCtrl.create({});
      myalert.setTitle('项目分类列表');
      myalert.addButton('OK');
    myalert.present();
  }
 

}

 

相关文章:

  • 2022-12-23
  • 2021-07-07
  • 2022-12-23
  • 2022-12-23
  • 2021-11-14
  • 2021-11-14
  • 2022-01-20
  • 2021-11-14
猜你喜欢
  • 2021-11-05
  • 2022-12-23
  • 2021-11-14
  • 2021-06-04
  • 2021-11-14
  • 2021-11-14
  • 2022-12-23
相关资源
相似解决方案