简体   繁体   English

如何在 Angular 8 中关闭按钮单击上的 p 对话框?

[英]How to close p-dialog on Button Click in Angular 8?

I want to close this dialog box when I click on button.单击按钮时,我想关闭此对话框。

    <p-dialog [(visible)]="displayFact" [modal]="true" [style]="[{width: '50%'}]" [baseZIndex]="1000" [draggable]="false" [resizable]="false" [closable]='true'>
     <div class="card rounded">
      <div>....</div>
      <a class="btn btn-primary w-25 mx-auto rounded mb-3" (click)= "closeDialog()">Close</a>
     </div> 
</p-dialog>

You can try the following to achieve this.您可以尝试以下方法来实现这一点。

closeDialog(){
    this.displayFact = false
}

API API

Visible boolean false Specifies the visibility of the dialog. Visible boolean false 指定对话框的可见性。

https://www.primefaces.org/primeng/showcase/#/dialog https://www.primefaces.org/primeng/showcase/#/dialog

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM