Search code examples
angularionic-frameworkionic4

Ionic 4 Angular - How to self dismiss a modal


In Ionic 3, dismissing a modal was pretty simple:

constructor(viewCtrl: ViewController) {
    this.viewCtrl.dismiss()
}

In Ionic 4, I can't import ViewController (or to be accurate, my IDE tries to import a type of ViewController).

I was wondering what the new approach of dismissing a modal is.


Solution

  • According to the docs, it looks like the dismiss method has moved to ModalController.

    So to dismiss a modal, I need to do:

    constructor(modalCtrl: ModalController) {
      modalCtrl.dismiss();
    }
    

    How i(r)onic that I find my answer AFTER I post the question.