在我的项目中,我们使用p-tree
中的primeng
。一切正常。我需要在树上实现过滤器。
当树加载数据时,所有节点都具有isVisible: true
,并且当用户在文本框中基于每个节点的标签设置isVisible
时,我们设置isVisible: false
,但是在ptree模板结构中,我不能使用*ngIf
<p-tree [value]="treeData">
<ng-template let-node *ngIf="node.isVisible" pTemplate="default" class="root-node">
...
</ng-template>
</p-tree>
使用*ngIf
时出现错误
ERROR TypeError: Cannot read property 'isVisible' of undefined