I would like to show toast msgs on errors globally but cant seem to find a way to have access to the toastcontroller in custom error handler. I would like access to loadingcontroller as well here but one thing at a time i guess,
Here is my code
class CustomErrorHandler implements ErrorHandler {
constructor(private toastCtrl: ToastController) {
}
handleError(err: any): void {
console.log("error caught globally", err);
}
}
having this i get a build error of
Runtime Error
Can’t resolve all parameters for CustomErrorHandler: (?).
I have
import { LoadingController, ToastController } from 'ionic-angular'; at the top of my app.module.ts where the error handler class resides.