ToastController not displaying message?!


#1

I have imported ToastController but it doesn’t seem to be working, I am not getting any errors, I am just not my Toast isn’t popping up?!

Please help

import { Component } from '@angular/core';
import { IonicPage, NavController, NavParams, ToastController } from 'ionic-angular';
import { AngularFireAuth } from 'angularfire2/auth';


@Component({
  selector: 'page-main',
  templateUrl: 'main.html',
})
export class MainPage {

  constructor(
    public navCtrl: NavController,
    public navParams: NavParams,
    private toast: ToastController,
    private aFauth: AngularFireAuth) {
  }

  ionWillViewLoad() {
    this.aFauth.authState.subscribe(data =>
    {
      if(data && data.email && data.uid){
      this.toast.create({
        message: `Welcome to APP_NAME ${data.email  }`,
        duration: 3000
      }).present();
      } else {
      this.toast.create({
        message: `Could not find authentication details`,
        duration: 3000
      }).present();
      }
    });
  }

}

#2

Did you import Toast to your app.module ?


#3

All sorted now Thanks!

It was this: ionWillViewLoad()

dur sill me!