title: Angularjs - showing element based on a presence of id in array
body: <p>Does anyoen know how to check (in the View) for a presence of id in a given array?</p>
  
  <p>Lets say I have an array like so:</p>
  
  <pre><code>var arr = [123, 456, 789];
  </code></pre>
  
  <p>and a data source like this:</p>
  
  <pre><code>var data = [
    {id: 123, name: 'foo'},
    {id: 456, name: 'bar'},
    {id: 789, name: 'baz'}
  ];
  </code></pre>
  
  <p>Now in the view while iterating over the <code>data</code> array I would like to show/hide elements based on a presence of <code>id</code> in the <code>arr</code> like so:</p>
  
  <pre><code>&lt;div ng-repeat="item in data"&gt;
      &lt;span ng-show="item.id in arr"&gt;&lt;/span&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>The above code <code>item.i in arr</code> of course does not work for obvious reasons. Anyone know how to achieve that functionality? Not to mention the ng-show block should always kick-in whenever the <code>arr</code> array is altered.</p>
  
  <p>Thanks in advance.</p>