@gundogduyakici wrote:
I am taking the data with JSON and I want to search. But no results are coming back. No error. Can you help me? Sample codes;
HTML Page;
<ion-searchbar (ionInput)=“getItems($event)” placeholder=“Müşteri arayın…”>
<ion-list *ngFor="let account of accountList"> <ion-item> <h2>{{ account.name }}</h2> <p>{{ account.phoneNumber }} • {{ account.billingAddressCity }}</p> <button ion-button clear item-end>Görüntüle</button> </ion-item> </ion-list>
TS Page functions;
auth.getAnyList(‘Account’).then((result) => {
if(result === true){
this.loading.dismiss();
this.accountTotal = auth.reply.total;
this.accountList = auth.reply.list;
}
}).catch(error => {
this.loading.dismiss();
console.log(“Error Message Meeting”);
});
}initializeItems(){
this.searchItems = this.accountList;
}getItems(ev: any) {
// Reset items back to all of the items
this.initializeItems();// set val to the value of the searchbar let val = ev.target.value; // if the value is an empty string don't filter the items if (val && val.trim() != '') { this.searchItems = this.searchItems.filter((item) => { return (item.name.toLowerCase().indexOf(val.toLowerCase()) > -1); }) }
}
Posts: 2
Participants: 2