我正在尝试向primeng树表添加过滤器功能。以下代码显示了我目前的情况。
<div class="content-section introduction">
<div>
<span class="feature-title">Katerra</span>
<span>Cost Master</span>
</div>
</div>
<div class="content-section implementation">
<p-growl [value]="msgs"></p-growl>
<input [(ngModel)]="searchText" placeholder="search text goes here">
<p-treeTable [value]="files6 | filter:searchText" selectionMode="single" [(selection)]="selectedFile2" [style]="{'margin-top':'50px'}" [contextMenu]="cm">
<p-header>Context Menu</p-header>
<p-column field="name" header="Division"></p-column>
<p-column field="size" header="Code"></p-column>
</p-treeTable>
<p-contextMenu #cm [model]="items"></p-contextMenu>
如您所见,我尝试添加
<input [(ngModel)]="searchText" placeholder="search text goes here">
并且还使用[value]="files6 | filter:searchText"
. 代码已成功编译,但这是在 chrome 控制台中打印的错误。
ERROR Error: Uncaught (in promise): Error: Template parse errors:
The pipe 'filter' could not be found ("
<input [(ngModel)]="searchText" placeholder="search text goes here">
<p-treeTable [ERROR ->][value]="files6 | filter:searchText" selectionMode="single" [(selection)]="selectedFile2" [style]="{'"): ng:///TreeTableDemoModule/TreeTableDemo.html@11:13
Error: Template parse errors:
The pipe 'filter' could not be found ("
任何建议都会很棒!