title: how to filter array with multiple properties in angular
body: <p>I have created a pipe in my angular 5 project, which will takes the input from html and filter array and will return filtered array. But currently I am passing the property name("firstName") from HTML file. Now i want that, it should filter from properties "firstName" and "lastName" both. Please tell me what should i change to do the same ???</p>
  
  <blockquote>
    <p>search-filter.pipe.ts</p>
  </blockquote>
  
  <pre><code>import { Pipe, PipeTransform } from '@angular/core';
  
  @Pipe({
      name: 'searchFilter'
  })
  export class SearchFilter implements PipeTransform {
      transform(data: any, search?: string, propertyName?: string): any {
          if (search === undefined) {
              return data;
          } else {
              return data.filter(obj =&gt; obj[propertyName].toLowerCase().includes(search.toLowerCase()));
          }
      }
  }
  </code></pre>
  
  <blockquote>
    <p>user.component.html</p>
  </blockquote>
  
  <pre><code>&lt;div class="row" *ngFor="let data of datas| searchFilter: search: 'firstName'}"&gt;
     {{data.lastName}}, {{data.firstName}}
  &lt;/div&gt;
  </code></pre>
  
  <blockquote>
    <p>sample-data.ts</p>
  </blockquote>
  
  <pre><code> datas: [
  { firstName: 'vipin', company: 'abc', lastName: 'sharma' },
  { firstName: 'kevin', company: 'abc2', lastName: 'xyz' },
  { firstName: 'Leos', company: 'abc3', lastName: 'abc' },
  ]
  </code></pre>