我的应用程序的初始部分包括从数据库加载数据,并使用垫子手风琴显示,如下所示:
async getVouchers() {
this._HttpService.get(${ServerUrl.ApiUrl}voucher).then(data => {
this.result = data;
if (this.result.vouchers.length > 0) {
this.hasVoucher = true;
this.dataSource = this.result.vouchers;
}
else {
this.hasVoucher = false;
}
this.skeleton = true;
})
}
<div class="ion-margin-top ion-margin-bottom" *ngFor="let data of dataSource">
<mat-accordion>
<mat-expansion-panel>
<mat-expansion-panel-header>
<mat-panel-title>
{{ data.name }}
</mat-panel-title>
</mat-expansion-panel-header>
<p>{{'voucher.messageTable' | transloco}} {{data.message}}</p>
....
</mat-expansion-panel>
</mat-accordion>
</div>
我正在努力创建一个过滤器,但没有工作。
<ion-searchbar show-clear-button=âalwaysâ placeholder=âSearchâ (keyup)=âfilterVoucher($event)â>
filterVoucher(event: Event) {
const filterValue = (event.target as HTMLInputElement).value;
this.dataSource.filter = filterValue.trim().toLowerCase();
}
有人可以帮我完成这个过滤器吗??
定义了一个离子搜索栏,并用Angular/javascript创建了基本过滤器,但它不起作用。