ionic2-Alert彈出框

下面爲函數Alert 彈出框的ts
import {Component} from '@angular/core';
import {NavController,LoadingController,AlertController} from 'ionic-angular';

@Component({
  templateUrl: 'build/pages/contact/contact.html'
})
export class ContactPage {
	public user={
       username : '',
       userpassword :'',

	}
  constructor(private navCtrl: NavController, private loadingCtrl: LoadingController, private alertCtrl: AlertController) {
  	this.navCtrl=navCtrl;
  }
  showFill(){

  	alert(this.user.username);
  	console.log(this.user.userpassword);
    if(this.user.username==""){
    	let alert = this.alertCtrl.create({
    		title: 'Low battery',
    		subTitle: '10% of battery remaining',
    		buttons: ['肯定']
	  });
	  alert.present();
    	} else{
	  	 let loading = this.loadingCtrl.create({
	      content: 'Please wait...'
	    });
 
    loading.present();
      setTimeout(() => {
      loading.dismiss();
    }, 5000);
}
  }
}
相關文章
相關標籤/搜索