Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

86
Vistas
Combinar múltiples resultados de búsqueda Angular 10

Quiero filtrar mis datos usando Nombre, número de móvil por un campo de entrada como filtro de tabla de datos de material. 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; }

Pero esto no está funcionando . ¿Alguien puede sugerirme cómo puedo filtrar datos?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Puedes lograrlo de la siguiente manera:

 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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda