in this video, I will show you that how you can display simple toast message in your ionic application.
Toast is a subtle notification that appears on top of an app’s content. Typically, Toasts are displayed for a short duration of time then automatically dismiss.
to create toast message first import this library
import { ToastController } from 'ionic-angular';
then create an instace of this ToastController
export class MyPage {
constructor(public toastCtrl: ToastController) {
}
after it create a method to display a toast message
presentToast() {
let toast = this.toastCtrl.create({
message: 'User was added successfully',
duration: 3000, // 3 secs
position : top// middle
});
toast.present();
}
}
then call this method in button
<button ion-button (click)="presentToast()">click me</button>
====================================================
to download full source code and presentation visit our wesite and Blog
website : - http://dotnetlab.in/
source code : - https://github.com/rahuljograna
facebook page :- https://www.facebook.com/DotnetLab-1896440207343189/
visit my blog : - http://aspnetinhindi.blogspot.in
follow me on twitter : https://twitter.com/THEJOGRANA
This comment has been removed by the author.
ReplyDelete