How to hide a modal?


I don’t really understand everything as for the modals… I can’t hide it, I don’t know where to put my dismiss() function : that’s the page in which I want the modal to open :

and here is my modal-login page :

can you please help me ? ty


First of all, you’ll need to make sure you assign your modal to a property of the class so it’s accessible to other functions in the class:

this.myLoginModal = this.modalCtrl.create(...);

Then from any other function you can call:


And it will close the modal.

Then - notice on your cancel button it has a (click) event that calls a dismiss() function - you now just need to create this function on your controller and inside it, call dismiss on your modal:

dismiss() {