title: How to filter array when object key value is in array
body: <p>I have an array model as below:</p>
  <pre><code>records:[{
      &quot;empid&quot;:1,
      &quot;fname&quot;: &quot;X&quot;,
      &quot;lname&quot;: &quot;Y&quot;
  },
  {
      &quot;empid&quot;:2,
      &quot;fname&quot;: &quot;A&quot;,
      &quot;lname&quot;: &quot;Y&quot;
  },
  {
      &quot;empid&quot;:3,
      &quot;fname&quot;: &quot;B&quot;,
      &quot;lname&quot;: &quot;Y&quot;
  },
  {
      &quot;empid&quot;:4,
      &quot;fname&quot;: &quot;C&quot;,
      &quot;lname&quot;: &quot;Y&quot;
  },
  {
      &quot;empid&quot;:5,
      &quot;fname&quot;: &quot;C&quot;,
      &quot;lname&quot;: &quot;Y&quot;
  }
  ]
  </code></pre>
  <p>Now I have an array of empid's <code>[1,4,5]</code>.</p>
  <p>So now I need to filter the first array which contains all the keys in my second.</p>
  <p><strong>Output:</strong></p>
  <pre><code>records:[{
      &quot;empid&quot;:1,
      &quot;fname&quot;: &quot;X&quot;,
      &quot;lname&quot;: &quot;Y&quot;
  },
  {
      &quot;empid&quot;:4,
      &quot;fname&quot;: &quot;C&quot;,
      &quot;lname&quot;: &quot;Y&quot;
  },
  {
      &quot;empid&quot;:5,
      &quot;fname&quot;: &quot;C&quot;,
      &quot;lname&quot;: &quot;Y&quot;
  }
  ]
  </code></pre>
  <p>I can do this using a <code>forEach</code> loop in <code>angular</code> but as I have more than 100 records in my model object.  I need a suggestion on how to handle this in much better way.</p>
  <p>I am thinking of creating a custom filter, but what is your take on it.(If yes please provide sample code to achieve this).</p>