我试图在对话框外单击时隐藏对话框,但是我无法在PrimeNG中使用dismissabeMask来实现。有人可以帮帮我吗?
HTML
<button type="text" (click)="showDialog()" pButton icon="fa-external-link-square" label="Show"></button>
<p-dialog [(visible)]="display" [(dismissableMask)]="mask">
<p-header>
Error Message
</p-header>
<label>Label</label>
<p-footer>
</p-footer>
</p-dialog
TS
mask: boolean = false;
showDialog() {
this.msg = this.errorMessages[id];
this.display = true;
this.mask = true;
}
答案 0 :(得分:2)
更改
<p-dialog [(visible)]="display" [(dismissableMask)]="mask">
带
<p-dialog [(visible)]="display" modal="true" dismissableMask="true">
如果您不添加modal="true"
,则无效(请参阅Plunker)