Ionic 4 Bugs LoadingController, AlertController, ToastController

Hello guys!

I’m having trouble using the LoadingController, ToastController and AlerControler on Ionic 4

import { Platform, NavController, NavParams, AlertController,
  LoadingController, ToastController } from '@ionic/angular';

@Injectable({
     providedIn: 'root'
})
export class BaseService {

constructor(public loadingCtrl: LoadingController, public alertCntrl: AlertController,
    public toast: ToastController, public platform: Platform) {

  }

Ionic info

Could anyone help me with this issue?
Thanks in advance!

In Ionic 4 the API changed for most presentable interfaces. Check out the beta docs for more details but here is how you create the alert/load/toast in Ionic 4:


They use async functions now keep the code functioning if the render takes a while.

2 Likes

It worked. Thanks a lot for the help! :smile:

Awesome to hear! Just be careful with async functions as they can get tricky when you add more code to them then just the presented interface but if you use a factory to control the alerts you should be fine.

Thanks so much! This was driving me nuts, got it working now :slight_smile: