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

158
Views
Return filter search results is not working in angular

I have one search box in my angular application. Search result should be return two object values like product_name and product_content.But in my application it is taking only one object.But i want to apply search option for both like product_name and product_content.

filter.pipe.ts:

return products.filter((items) => {
  return (
    items.product_name.toLowerCase().includes(searchText), // Not working
    items.product_content.toLowerCase().includes(searchText) // working
  );
});

So, How to resolve this issue? If anyone knows help to find the solution.

Demo: https://stackblitz.com/edit/angular-selvam-ecommerce-task-mffqdn?file=src%2Fapp%2Fpipes%2Ffilter.pipe.ts

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

return products.filter((items) => {
  return (
    items.product_name.toLowerCase().includes(searchText.toLowerCase()) ||
    items.product_content.toLowerCase().includes(searchText.toLowerCase()) 
  );
});

Instead of , put an || to check both conditions.

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!