本文整理匯總了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();
}