Friday, July 31, 2020

Ionic 4 + Angular 9 Code

Ionic 4 + Angular 9

Creation of Toast Controller Common Class


Create Toast Common Class

Create a class which takes Toast Controller instance as constructor parameter


export class ToastNotification {
    constructor(private toast){}
    async openToast(message,duration,position){
        const toast = await this.toast.create({
          message:message,
          duration:duration,
          position:position
        });
        toast.present();
      }
}



Create Instance of the ToastNotification Class and use the object to access OpenToast Function
 
    import {ToastNotificationfrom '../../_helpers/toastnotification';
import { ToastControllerfrom '@ionic/angular';

    export class example {
    constructor(private toast:ToastController){}
toastpop = new ToastNotification(this.toast);
    this.toastpop.openToast("Hello World",2000,top);
    }



Wednesday, December 30, 2009

Welcome

Hey this is Ravi Varma welcome to my blog here u can get most of things and stuff so be honest and understanding