ionic3 Alert组件的使用方法

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();
} }
上一篇:Cannot set property 'onclick' of null的问题


下一篇:UVaLive 5760 Alice and Bob (博弈 + 记忆化搜索)