Ionic 4 Modal Events

Hi,

Can anyone tell me how to listen to modal events from within the modal component in Ionic 4?
I’m trying to listen on the “ionModalDidPresent” event so I can update the size of an internal element based on the size of the modal.

I’ve tried various things:

  • @HostListener decorator
  • modalCtrl.getTop() … addEventListener
  • as above, but using using Renderer2

Using @HostListener(‘click’) works… when I click on the modal, so I think I’m on the right track, but I cant get the ionModalDidPresent event.

Thanks

Ian

1 Like

see this issue - https://github.com/ionic-team/ionic/issues/15806

for now it seems like you need to use the default angular lifecycle events

https://angular.io/guide/lifecycle-hooks