Ionic - Error: Uncaught (in promise): removeView was not found

Samir Boulos picture Samir Boulos · May 7, 2017 · Viewed 31.5k times · Source

My Ionic app was working fine and I haven't done anything to it but suddenly I am getting this error and I don't know why.

"Error: Uncaught (in promise): removeView was not found

Answer

Manoj Negi picture Manoj Negi · Jul 14, 2017

Deleting a component is not a solution to any problem.

Cause of issue: There are multiple calls to dismiss method of loading component.

Solution: While creating the loader, check if the loader instance is not already present, only then create another instance.

Similarly, while dismissing the loader, check if the loader instance does exists, only then dismiss it.

Code:

constructor(private _loadingCtrl: LoadingController){}

loading;

showLoading() {
    if(!this.loading){
        this.loading = this._loadingCtrl.create({
            content: 'Please Wait...'
        });
        this.loading.present();
    }
}

dismissLoading(){
    if(this.loading){
        this.loading.dismiss();
        this.loading = null;
    }
}