-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Description
Describe the Bug
modalController instead of opening the modal, like would happen when you press the open button, it opens a black modal that covers all the screen
Expected Behavior
Open the modal in the same way it would open when pressing the button.
Steps to Reproduce
Use any example in here https://ionicframework.com/docs/api/modal and convert it to use Composite API of Vue3.
As in the examples, I have my modal inside the same page as the rest of the code.
I will pick one random:
<template>
<ion-header>
<ion-toolbar>
<ion-title>Inline Modal</ion-title>
</ion-toolbar>
</ion-header>
<ion-content class="ion-padding">
<ion-button id="open-modal" expand="block">Open</ion-button>
<p>{{ message }}</p>
<ion-modal ref="modal" trigger="open-modal" @willDismiss="onWillDismiss">
<ion-header>
<ion-toolbar>
<ion-buttons slot="start">
<ion-button @click="cancel()">Cancel</ion-button>
</ion-buttons>
<ion-title>Welcome</ion-title>
<ion-buttons slot="end">
<ion-button :strong="true" @click="confirm()">Confirm</ion-button>
</ion-buttons>
</ion-toolbar>
</ion-header>
<ion-content class="ion-padding">
<ion-item>
<ion-label position="stacked">Enter your name</ion-label>
<ion-input ref="input" type="text" placeholder="Your name"></ion-input>
</ion-item>
</ion-content>
</ion-modal>
</ion-content>
</template>I do not want to move this modal into its own component.
I want it on the same page as the rest of the code, like in your examples.
If I press the button to open, it opens!!! but if I do something like this:
const openEditPanel = async () => {
console.log("openEditPanel()")
const myModal = await modalController.create({
component: IonModal, //Modal is name of the component to render inside ionic modal
});
myModal.present();
})
It shows a black empty modal.
So, the question is... how do I trigger programmatically the modal to show up like I would do with the button, without having to move the modal into its own component?
Screenshots
Here is the black screen I'm talking about:
Here it shows that intead of affecting IonModal I have in the page, it creates an empty modal instead:

Operating System
No response
Browser
No response
Version
No response
Additional Information
Thank you for your time.
