1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Erro com a barra de pesquisa - Ionic

Discussion in 'Technology' started by Leonardo Sartori, Oct 8, 2018.

  1. Pedido.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

    }
    })


    pedido.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>

    Login To add answer/comment
     

Share This Page