Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

115
Visualizações
Search bar in Ionic using pipe filter

Oops guys, I have the following problem, I made this pipe filter to filter this information, but I needed to filter 2 more pieces of information, but I have no idea how to do this in this pipe. I'll leave the example of the pipe I made below

/*** PIPE ***/

import { Pipe, PipeTransform } from '@angular/core';

@Pipe({
  name: 'filter'
})
export class FilterPipe implements PipeTransform {

  transform(nomes: any, search: []): any {

    if (search === undefined) { return nomes }
    return nomes.filter(function(nome){
      Here, I needed to filter, nome?.city, nome?.age
      return nome?.titulo?.includes(search)
    })
  }

}
/*** HTML ***/

<ion-searchbar [(ngModel)]="search" name="search"></ion-searchbar>

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Add this code in HTML Page

<ion-searchbar color="light" class="ion-no-padding" [(ngModel)]="searchData" mode="ios"
        [placeholder]="'Search '+pageName">
      </ion-searchbar>

<ion-row *ngFor="let item of checkContent | filterData : ['city','age'] : searchData">
</ion-row>

Add this code in Filter Pipe

transform(items: any[], field: any[], value: string): any[] {
        if (!items || !value || !field) {
          return items;
        }
    
        let lowSearch = value.toLowerCase();
        return items.filter((item) => {
          return field.some(key =>
            String(item[key]).toLowerCase().includes(lowSearch)
          );
        });
      }
about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda