Search code examples
angulartypescriptprimengprimeng-dialog

PrimeNG Dynamic Dialog - Close by click to nowhere


I use a Dynamic Dialog from PrimeNG.

How can I force to close the dialog by clicking in the "nowhere" area around the dialog? Currently I only can close the dialog by using buttons within the dialog.


Solution

  • You can use dismissableMask property to do that.

    dismissableMask property specifices if clicking the modal background should hide the dialog.

        this.dialogService.open(ProductListDemo, {
            header: 'Choose a Product',
            width: '70%',
            contentStyle: {"max-height": "500px", "overflow": "auto"},
            baseZIndex: 10000,
            dismissableMask: true
        });