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