Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How Can I make modal to become full-screen in Ionic2?

Here is my modal code:

    let modal = Modal.create(DailyReportPage);
    this.nav.present(modal);

It works fine on Phone, however on the tablet it looks like this: enter image description here What I want is to make it look like this: enter image description here

like image 584
Vicheanak Avatar asked Aug 16 '16 14:08

Vicheanak


Video Answer


4 Answers

I apply this style:

ion-modal {
    .modal-wrapper {
        position: absolute;
        top: 0;
        left: 0;
        display: block;
        width: 100%;
        height: 100%;
    }
}
like image 161
Vicheanak Avatar answered Oct 13 '22 02:10

Vicheanak


You can override the related Ionic Sass variables in file variables.css:

$modal-inset-width: 100%;
$modal-inset-height-large: 100%;

Documentation (current version is 3.9, but I use this with 3.7): http://ionicframework.com/docs/theming/overriding-ionic-variables/

like image 27
bvamos Avatar answered Oct 13 '22 02:10

bvamos


You should follow Modal

A Modal is a content pane that goes over the user's current page. Usually it is used for making a choice or editing an item.

So If you want to show full screeen. I think you create new page and push to it

this.nav.push(SamplePage, {item: item});
like image 20
nahoang Avatar answered Oct 13 '22 01:10

nahoang


Apply this style inside your scss file

ion-modal {
    .modal-wrapper {
        position: absolute;
        top: 0;
        left: 0;
        display: block;
        width: 100%;
        height: 100%;
    } }

It should be out side of your selector.

ex: -

page-mymodal {
    //page CSS Codes
}
ion-modal {
    .modal-wrapper {
        position: absolute;
        top: 0;
        left: 0;
        display: block;
        width: 100%;
        height: 100%;
    } 
}
like image 29
Roney Francis Avatar answered Oct 13 '22 01:10

Roney Francis