[英]p-dialog onHide is not working with ngIf?
Already SO has the similar question , I tried with those solution but not working.已经有类似的问题,我尝试使用这些解决方案但没有工作。
Actual the problem is onHide event is not triggering because of the *ngIf
, If I removed the *ngIf
onHide is triggering.实际问题是 onHide 事件没有触发,因为
*ngIf
,如果我删除了*ngIf
onHide 正在触发。
<p-dialog [(header)]="dialogText" *ngIf="displayDlg" [(visible)]="displayDlg"
[modal]="true" [responsive]="true" (onHide)="close()">
But the problem is I am having the form inside the <p-dialog
If I am not using the *ngIf
I am getting the undefined error when loading the page.但问题是我在
<p-dialog
有表单如果我没有使用*ngIf
我在加载页面时收到未定义的错误。 How can I fix this issue.?我该如何解决这个问题。?
<ng-container *ngIf="displayDlg">
<p-dialog [(header)]="dialogText" [(visible)]="displayDlg"
[modal]="true" [responsive]="true" (onHide)="close()">
</ng-container>
add your form loading logic in *ngIf of ng-container.在 ng-container 的 *ngIf 中添加表单加载逻辑。
I had the same problem.我有同样的问题。 Solved by using a different boolean variable for the *ngIf in the p-dialog tag compared to the [(visible)] attribute.
与 [(visible)] 属性相比,通过对 p-dialog 标签中的 *ngIf 使用不同的布尔变量来解决。 Using the same variable for both it did not work for me.
对两者使用相同的变量对我来说不起作用。 That is the basic idea.
这就是基本思想。 I did it in an object oriented way.
我以面向对象的方式做到了。 I won't bore you with further details.
我不会让你厌烦更多的细节。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.