I want to show in a toast some data I get from a JSON.
So I did the presentToast(), but can’t insert the {{…}}
presentToast() {
let toast =this.toastCtrl.create({
message: 'Tele: ' + {{item.otherOwner.phone}},
position: 'bottom',
showCloseButton: true
});
toast.present();
}
thanks in advance
Hi @nicolas_hie,
Please try below mentioned code.
presentToast() {
let toastMsg = item.otherOwner.phone;
let toast =this.toastCtrl.create({
message: 'Tele: ' + toastMsg,
position: 'bottom',
showCloseButton: true
});
toast.present();
}
Hope this will resolve your issue.
First of all, thanks for your help.
But when I use let toastMsg = item.otherOwner.phone;
I get: Cannot find Name "item"
If i use let toastMsg = this.item.otherOwner.phone;
I get: Cannot read property 'otherOwner' of undefined
But it is the right path… I use the same with item.otherOwner.displayName
in the HTML and it works just fine
Are you sure that the api call has finished before you try to show the toast?
how do you call your api and where do you show the toast?
I’m sorry
I simply forgot to navParams…
now it works the way I wanted
thank you very much