如何使用 p-listbox 过滤多个标签?

Saa*_*ali 5 listbox filter primeng angular

我想过滤多个标签,有没有办法让 optionLabel 可以有多个选项?

<p-listbox [options]="sites" `enter code here`[(ngModel)]="selectedSite" class="ui-fluid" [listStyle]="{'max-height':'300px'}" filter="filter" optionLabel="name">

              <p-header>
                <strong>{{ 'select-site.choose' | translate}}</strong>
              </p-header>
              <ng-template let-site pTemplate="item">
                <span>{{site.value.code}} - {{site.value.name}}</span>
              </ng-template>
</p-listbox>
Run Code Online (Sandbox Code Playgroud)

我想过滤代码和名称

Aru*_*mar 0

是的。prime ng 在 p-listbox 中已经有多个属性。只需添加到 p-listbox 中

multiple=true
Run Code Online (Sandbox Code Playgroud)

https://www.primefaces.org/primeng/#/listbox请参阅属性部分