p-dialog onHide 不适用于 ngIf? [英] p-dialog onHide is not working with ngIf?
本文介绍了p-dialog onHide 不适用于 ngIf?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
SO 已经有类似的问题,我尝试了这些解决方案,但没有奏效.
Already SO has the similar question, I tried with those solution but not working.
实际问题是 onHide 事件没有触发,因为 *ngIf
,如果我删除了 *ngIf
onHide 触发.
Actual the problem is onHide event is not triggering because of the *ngIf
, If I removed the *ngIf
onHide is triggering.
<p-dialog [(header)]="dialogText" *ngIf="displayDlg" [(visible)]="displayDlg"
[modal]="true" [responsive]="true" (onHide)="close()">
但问题是我在 <p-dialog
中有表单如果我没有使用 *ngIf
我在加载时收到未定义的错误页.我该如何解决这个问题.?
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. How can I fix this issue.?
推荐答案
<ng-container *ngIf="displayDlg">
<p-dialog [(header)]="dialogText" [(visible)]="displayDlg"
[modal]="true" [responsive]="true" (onHide)="close()">
</ng-container>
在 ng-container 的 *ngIf 中添加你的表单加载逻辑.
add your form loading logic in *ngIf of ng-container.
这篇关于p-dialog onHide 不适用于 ngIf?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文