Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Open fullscreen modals using primeng dynamic dialog

I am using the PrimeNg modal extension for displaying modal popups in one of the Angular webapp I am working on. I am passing a component to the modal service as shown in the following code:

const ref = this.dialogService.open(LogsComponent, {
            data: {
                releaseID:row.release_id
            },
            header:'Migration Logs',
            width:'100%', 
            height:'100%'
        });

I am getting the ID that I passed and is able to display a table in the modal. Now the problem is even if I give 100% width and height, the modal is not appearing as full screen. I would like to have the modal maximized as it is for the PrimeNg Dialog.

like image 639
Happy Coder Avatar asked Oct 28 '25 03:10

Happy Coder


2 Answers

For primeng ~13 using the p-dialog tag, you can do the following:

<p-dialog #dialog (onShow)="dialog.maximize()">dialog text</p-dialog>
like image 180
Saint48198 Avatar answered Oct 29 '25 17:10

Saint48198


put these to styles.css. It accepts all dialogs if you want to only this one then give custom class and change ui-dialog with with custom class name

.ui-dialog {
    max-height: 100%;
}
.ui-dialog .ui-dialog-content {
    height: 100%;
}

with custom class

const ref = this.dialogService.open(LogsComponent, {
            data: {
                releaseID:row.release_id
            },
            header:'Migration Logs',
            width:'100%', 
            height:'100%',
            styleClass:"customModal"
        });

and in styles.css

.customModal {
    max-height: 100%;
}
.customModal .ui-dialog-content {
    height: 100%;
}
like image 43
mr. pc_coder Avatar answered Oct 29 '25 16:10

mr. pc_coder



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!