title: AngularJS filter multiple select inputs
body: <p>I am really surprised there is no documentation anywhere or questions regarding this more advanced filtering mechanism for AngularJS - it is essential for any UI.</p>
  
  <p>I need to filter out select options that include the current item. The question is how can I splice out each options as we iterate through the <em>items</em> coming to our filter, and return the proper results for each select in the list being filtered.</p>
  
  <p>for instance, if we have three regions - Canada, United Kingdom, United States - the select input should read like this:</p>
  
  <pre><code>Canada
    [select]
      [option0] United Kingdom
      [option1] United States
  
  United Kingdom
    [select]
      [option0] Canada
      [option1] United States
  
  United States
    [select]
      [option0] Canada    
      [option1] United Kingdom 
  </code></pre>
  
  <p><em>.. and so on...</em></p>
  
  <p>HTML:</p>
  
  <pre><code>&lt;div ng-repeat="region in data.regions"&gt;
      &lt;h2&gt; {{region.name}} &lt;/h2&gt;
      &lt;input ui-select2="version2" type="hidden" name="keywordsLocal-{{$index}}" class="region-keywords input-xlarge" data-ng-model="data.regions[$index].keywords" required-multiple /&gt;
      &lt;select ui-select2 id="copy-{{$index}}" ng-show="region.length &gt; 1" class="input-xlarge" ng-click="_copy($event, $index)" data-ng-model="data.regions[$index].keywords"&gt;
          &lt;option value=""&gt;Use the same keywords as:&lt;/option&gt;
          &lt;option ng-repeat="region in data.regions | myFilter" value="{{region.keywords}}"&gt;{{region.name}}&lt;/option&gt;
      &lt;/select&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>Javascript:</p>
  
  <pre><code>app.filter('myFilter', function() {
  
      return function(items) {
          var group = [];
  
          for (var i = 0; i &lt; items.length; i++) {
              group.push(items.name);
          }
  
          for (var i = 0; i &lt; group.length; i++) {
             group[i].splice(i, 1);
          }
  
          return group;
  
      };
  
  });
  </code></pre>