[IONIC 4] Modal always showing up automatically

Hi guys,

Today I’m trying to add a modal page into my app. I open it when clicking on a button.
But the problem is it’s showing as soon as I reach my page, and I can’t dismiss it…

To implement it, I followed this guide: https://medium.com/@david.dalbusco/how-to-declare-and-use-modals-in-ionic-v4-4d3f42ac30a3

async openVideoConseil(video) {
  const modal = await this.modal.create({
    component: VideoModalPage,
    componentProps: {
      'video': video,
    }
  });
  return await modal.present();
}

I called a console.log('open modal'); here but it’s never shown, even if the modal gets opened.

The only time I call my modal is in my template code, when clicking on a button.

If you need anything else, feel free to ask

Thanks !

I think I had a similar problem back a few months ago. I think the problem was that I was including the ModelPage in app.module.ts when I should not have. Not sure where I had it in app.module.ts, so perhaps this hint isn’t very helpful.

1 Like

Yes that was it, I was including the ModalPageModule in my page module, but I had to include it in my app module.ts actually !