I’ve seen that a few users are having difficulties making their modals take up the full width and height of the device.
This is a small tutorial to explain how this can be achieved.
You need to write the code to show a modal using the ModalControler:
let modal = this.modalCtrl.create(ArticledetailPage});
Add the cssClass property to the modalOptions when creating the options.
This can be any name you want, but we will need it later.
Make sure that the 2nd parameter is undefined if you don’t pass any data.
let modal = this.modalCtrl.create(ArticledetailPage, undefined, { cssClass: "modal-fullscreen" });`
Because a modal gets created outside the scope of a page, we need to define the properties in the global app.scss file. So not in the scss-file of the page you are trying to show in the modal.
This code will make sure the modal is show fullscreen.
If you have chosen a different cssClass, have you to change modal-fullscreen to the custom name.
Conclusion:
Only the modal with the cssClass of “modal-fullscreen” will be shown fullscreen. Other modals will be unaffected and show according to the size of the device where it is shown.
Unfortunately this is not working for me. I made both changes (in app.scss), but it appears just as before. Is it possible that there is something missing anywhere?
Can you check if the modal gets the “modal-fullscreen” class added to the “ion-modal” element?
You can do this by right-clicking and choosing “Inspect element” in Chrome
Oh, thank you for your respond! Inspecting the modal brought me to the point that I’ve added css-class on the wrong place. Works now like a charme.
Thanks for sharing this!