Ionic v4 Modal Controller question - this.modal and this.modalController

We had a modal that needed to present another modal.

Within modal #1, the constructor is injected with private modal: ModalController and ModalController is imported from @ionic/angular.

However, when we try to create another modal: it says that this.modal.create() is not a function. Weird… so when we look at this.modal it appears to be an instance of the Overlay. That is, I can call dismiss() on it, but I cannot call create().

If I add another item to the constructor @Inject('ModalController') modalController: ModalController, that one appears to work as expected.

What’s also weird is that if I remove public modal: ModalController from the constructor and add it as a property of the class, it exists and I can see what it is (it links to the instance of the HtmlIonElementModal or whatever it is).

Finally, if I just call this.modalController.dismiss() instead of this.modal.dismiss() it appears to work as expected.

I’ve spent way too long on this already, but it appears to be some sort of weird Dependency Injection issue. Like, perhaps it wants something named modal to be added into the control? FWIW, it seems that this.modal is always there, even if it’s not defined in the constructor.

Anyone know why this is? Trying to read through the ionic docs doesn’t go anywhere and I followed the code up until createOverlay() but I’m not sure what customComponents is… besides it works and I need to move on. :slight_smile: