Ionic Vue Modal Controller

Hello I would like know how I can close modal created at modal controller with custom component

    async function openSendFinalize() {
      const consend = await modalController.create({
        component: Corfirm,
        componentProps: {
          uid: transfering.identifier,
          amount: transfering.song,
          message: transfering.message,
        },
        cssClass: "consend__half-container",
        showBackdrop: false,
        swipeToClose: true,
        mode: "ios",
      });
      return consend.present();
    }

at the Confirm.vue component I have no access to modal created from parent component

I was able to do this using a hacky technique by simulating click backdrop

Closed

You can also dismiss the top-most modal using modalController.getTop:

const modal = await modalController.getTop();
modal.dismiss()
2 Likes

Oh man, this is the best solution? Feels like baseline functionality for a modal to be able to dismiss itself. I know the Angular folks can get the controller injected into the component, is there no equivalent that can be implemented for Vue?

what’s the difference between angular getting the controller injected and calling

const modal = await modalController.getTop();
modal.dismiss()

you can also just create the modal in the template