代码语言:javascript复制
下面为函数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);
}
}
}
(adsbygoogle = window.adsbygoogle || []).push({});