Angular 如何设置图标而不是占位符角度2

Angular 如何设置图标而不是占位符角度2,angular,filter,datatable,placeholder,primeng,Angular,Filter,Datatable,Placeholder,Primeng,我已经实现了过滤器 我的代码如下: 您可以尝试实现模板化 如果您需要一个简单的解决方案,那么您可以覆盖css类 .fa-caret-down:before { content: "\f002"; } 在添加该类之前,通过添加[styleClass]属性,在multiselect组件中添加一个命名的css类。 通过这种方式,您可以避免在项目中的其他类中受到影响。只需使用[hidden]和一个额外变量showFilter: <p-column field="time" header

我已经实现了过滤器 我的代码如下:


您可以尝试实现模板化

如果您需要一个简单的解决方案,那么您可以覆盖css类

.fa-caret-down:before {
    content: "\f002";
}
在添加该类之前,通过添加
[styleClass]
属性,在multiselect组件中添加一个命名的css类。
通过这种方式,您可以避免在项目中的其他类中受到影响。

只需使用
[hidden]
和一个额外变量
showFilter

<p-column field="time" header="Time" [filter]="true" filterPlaceholder="" filterMatchMode="in">
  <ng-template pTemplate="filter" let-col>
    <i class='fa fa-search' (click)='showFilter = !showFilter'></i>
    <p-multiSelect [hidden]="!showFilter"
                    [options]="timeOptions" 
                    styleClass="ui-column-filter" 
                    (onChange)="dt.filter($event.value,col.field,col.filterMatchMode)">
    </p-multiSelect>
  </ng-template>
</p-column>


但是我想要搜索图标而不是下拉字段?
意味着你需要文本搜索过滤器来代替下拉字段?请您解释一下好吗?下拉列表仅供搜索。。我只需要搜索图标,点击后会显示下拉列表。@SargamSanghani,很高兴知道,快乐编码:)