本文整理汇总了TypeScript中ionic-angular.ToastController类的典型用法代码示例。如果您正苦于以下问题:TypeScript ToastController类的具体用法?TypeScript ToastController怎么用?TypeScript ToastController使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ToastController类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: presentToast
private presentToast(success: boolean, response: any): void {
const message: string = success
? 'Transaction successfully broadcast. Trasaction id: ' + response.txid
: 'An error occurred: ' + response;
if (this.toast) {
this.toast.dismiss();
}
this.toast = this.toastCtrl.create({
message,
position: 'bottom',
showCloseButton: true,
dismissOnPageChange: true
});
this.toast.present();
}
示例2: identify
identify(phone){
// this.item['note'] = phone;//把手机号码传回去
// console.log(this.item)
console.log(phone);
let toast = this.toastCtrl.create({
message: '修改成功',
duration: 1500,
position: 'middle'
});
toast.present();
toast.onDidDismiss(() => {
console.log('Dismissed toast');
this.viewCtrl.dismiss(phone);
});
}
示例3: presentToast
presentToast() {
let toast = this.toastCtrl.create({
message: 'Thank You, You Will Be Notified!',
duration: 3000,
position: 'bottom',
showCloseButton: true,
closeButtonText: 'Ok',
dismissOnPageChange: true
});
toast.onDidDismiss(()=>{
console.log('Dismissed Toast');
});
toast.present();
}
示例4:
this.sw.updates.subscribe(res => {
if (res.type === 'pending') {
let toast = this.toastCtrl.create({
message: 'A new version is available, reload ',
closeButtonText: "Reload",
showCloseButton: true,
});
toast.onDidDismiss((data, role) => {
if (role === 'close') {
this.sw.activateUpdate(res.version)
.subscribe(value => value && location.reload());
};
});
toast.present();
}
});
示例5: if
this.events.subscribe('wordpress:savestatus', (state) => {
console.log(state);
if (state.state === 'saving') {
this.loader.present();
console.log('saving');
}
else if (state.state === 'error') {
this.loader.dismiss();
this.createLoader();
this.toastCtrl.create({ message: 'Error Saving Report', duration: 3000 }).present();
}
else if (state.state === 'finished') {
this.loader.dismiss();
this.createLoader();
console.log('finished');
}
});
示例6: handleError
handleError(error: any) {
let message: string;
if (error.status && error.status === 401) {
message = 'Login failed';
}
else {
message = `Unexpected error: ${error.statusText}`;
}
const toast = this.toastCtrl.create({
message,
duration: 5000,
position: 'bottom'
});
toast.present();
}
示例7:
data => {
loading.dismissAll();
if (data === undefined && data.fileasbase64 == undefined) {
let toast = this.toastController.create({
message: 'Unable to get file content',
duration: 3000,
position: 'middle'
});
toast.present();
}
else {
this.openDocument(item.name, data.mimeType, data.fileAsBase64);
//open(cordova.file.applicationDirectory + item.url, '_blank', 'location=no,enableViewPortScale=yes');
}
},
示例8: toastShowWithOptions
toastShowWithOptions(options: ToastOptions) {
if (this.isMobile()) {
this.toast.showWithOptions(options).subscribe(
toast => {
}
);
} else {
let toast = this.toastCtrl.create({
message: options.message,
duration: options.duration,
position: options.position
});
toast.present();
}
}
示例9:
data => {
loading.dismissAll();
this.caFileList = data;
if (this.caFileList === undefined || this.caFileList.length === 0) {
let toast = this.toastController.create({
message: 'Credit Review documents are not available for the counterparty',
duration: 3000,
position: 'middle'
});
toast.present();
}
else {
//this.showCaActionSheet(); //For this version there is only Action Items. Let's go directly
//open the list of documents for the cp
this.navCtrl.push(CounterpartyCaPage,
{ "counterpartyName": this.cpInfo.name, "documents": this.caFileList });
}
},
示例10:
this.http.get(api.url + '/users/forLikes/'+user_id+'/0', api.setHeaders(true)).subscribe(data => {
loading.dismiss();
this.users = data.json().users.items;
this.texts = data.json().texts;
// If there's message, than user can't be on this page
if (data.json().arenaStatus) {
let toast = this.toastCtrl.create({
message: data.json().arenaStatus,
showCloseButton: true,
closeButtonText: 'אישור'
});
toast.present();
this.navCtrl.push(ChangePhotosPage);
}
});