Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

88
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!