本文整理汇总了TypeScript中ionic-angular.Toast类的典型用法代码示例。如果您正苦于以下问题:TypeScript Toast类的具体用法?TypeScript Toast怎么用?TypeScript Toast使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Toast类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: bgToggle
/* Toggle for enabling and disabling background mode */
bgToggle() {
/* If already enabled, disable, notify user */
if (cordova.plugins.backgroundMode.isEnabled()) {
cordova.plugins.backgroundMode.disable();
this.bgText = "Enable Background Mode";
this.storage.storeBackgroundMode(null);
let toast = Toast.create({
message: "Background Mode Disabled",
duration: 2000,
position: 'bottom',
showCloseButton: true
});
this.nav.present(toast);
}
/* Otherwise already disabled, so enable, notify user */
else {
cordova.plugins.backgroundMode.enable();
this.bgText = "Disable Background Mode";
/* Note that since storage works with strings, this could
be any string. More intuitive this way */
this.storage.storeBackgroundMode(true);
let toast = Toast.create({
message: "Background Mode Enabled",
duration: 2000,
position: 'bottom',
showCloseButton: true
});
this.nav.present(toast);
}
}
示例2:
},error => {
let toast = Toast.create({
message: "登录失败!",
duration: 2000
})
this.nav.present(toast)
})
示例3: validateUser
validateUser() {
var user = {
email: this.email,
password: this.password
}
if (!this.email || !this.password) {
let toast = Toast.create({
message: 'Please enter valid details',
duration: 3000
});
this.nav.present(toast);
return false;
}
let loading = Loading.create({
content: 'Please wait...'
});
this.nav.present(loading);
var self = this;
this.backend.loginUser(user).then(function () {
loading.dismiss();
}).catch(function (e) {
console.log("error invalid user", e);
})
}
示例4: showLoginFailure
showLoginFailure(message: string) {
let toast = Toast.create({
message: message,
duration: 3000
});
this.nav.present(toast);
}
示例5: mostrarErro
mostrarErro(erro: any, navCtrl: NavController) {
let toast = Toast.create({
message: erro,
duration: 3000
});
navCtrl.present(toast);
}
示例6: showToast
showToast(msg: string): void {
let toast = Toast.create({
message: msg,
duration: 3000
});
this.nav.present(toast);
}
示例7: oops
oops(navC:NavController) {
navC.present(Toast.create(
{
message: 'oops! something went wrong.',
duration: 1500
}))
}
示例8: validateUser
validateUser() {
var user = {
email: this.email,
password: this.password
}
if (!this.email || !this.password) {
let toast = Toast.create({
message: 'Please enter valid details',
duration: 3000
});
this.nav.present(toast);
return false;
}
let loading = Loading.create({
content: 'Please wait...'
});
this.nav.present(loading);
var self = this;
this.backend.loginUser(user).then(function () {
localStorage.setItem('email', user.email);
setTimeout(() => {
loading.dismiss();
});
if (self.backend.userDetails.isProfessor) {
self.nav.push(TabsPage);
} else {
self.nav.push(StudentTabsPage);
}
}).catch(function() {
console.log("error invalid user");
})
}
示例9:
}, error => {
l.dismiss();
let t = Toast.create({
message: 'Sin conexion!',
duration: 2000
})
});
示例10: create
create(message, ok = false, duration = 2000) {
if (this.toast) {
this.toast.dismiss();
}
this.toast = this.toastCtrl.create({
message,
duration: ok ? null : duration,
position: 'bottom',
showCloseButton: ok,
closeButtonText: 'OK'
});
this.toast.present();
}