Error with search bar - Ionic

0

Order.ts:

 getItems(ev: any) {
const val = ev.target.value;
if (val == '') {
  this.clientes = null;
} else if(val  && val.trim() != ''){    
 this.buscarUsuario(ev);

}

 selectItem() {
  this.clientes = this.clientes.filter((cliente) => {
  this.pesquisa = cliente.cliente;
  this.clientes = [];


})

 buscarUsuario(ev: any) {

  this.provider.buscarCliente().subscribe((cliente: Array<any>) => {
    this.clientes = cliente;
    console.log(this.clientes);
    let val = ev.target.value;
    if(val == this.clientes){ 
    val = this.clientes

  }
})

order.html

 <ion-row >
      <ion-col>
        <ion-searchbar [(ngModel)]="pesquisa" (ionInput)="getItems($event)" formControlName="cliente" placeholder="Pesquisar"></ion-searchbar>
        <ion-item *ngFor="let cliente of clientes">

         <button ion-button (click)="selectItem()">{{cliente.cliente}}</button>

        </ion-item>
      </ion-col>

    </ion-row>
    
asked by anonymous 08.10.2018 / 19:25

0 answers