@nvahalik wrote:
We had a modal that needed to present another modal.
Within modal #1, the constructor is injected with
private modal: ModalControllerandModalControlleris 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 atthis.modalit appears to be an instance of the Overlay. That is, I can calldismiss()on it, but I cannot callcreate().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: ModalControllerfrom 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 ofthis.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
modalto be added into the control? FWIW, it seems thatthis.modalis 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
customComponentsis… besides it works and I need to move on.
Posts: 1
Participants: 1
