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

89
Visualizações
Combine multiple search result Angular 10

I want to filter my data using First name , mobile number by one input field like material dataTable filter. constructor:

  constructor() {
            this.filteredPatient = this.patientsearch.valueChanges
              .pipe(
                startWith(''),
                map(p => p ? this._filterPatient(p) : this.patients.slice())
                    );
          }



    private _filterPatient(value: string): IPatient[] {
    const filterValue = value.toLowerCase();

    const searchByfirstName = this.patients.filter(p => p.firstName.toLowerCase().includes(filterValue));
    const searchBylastName = this.patients.filter(p => p.lastName.toLowerCase().includes(filterValue));
    const searchBymobileNumber = this.patients.filter(p => p.mobileNumber.toLowerCase().includes(filterValue));
    const mergedObj = { ...searchByfirstName, ...searchBymobileNumber };
    return mergedObj;
  }

but this is not working . Can anyone suggest me how can I filter data .

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

0

You can achieve that like the following:

private _filterPatient(value: string): IPatient[] {
  const filterValue = value.toLowerCase();

  const result = this.patients.filter(
    (p) =>
      p.firstName?.toLowerCase().includes(filterValue) ||
      p.lastName?.toLowerCase().includes(filterValue) ||
      p.mobileNumber?.toLowerCase().includes(filterValue)
  );

  return result;
}
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