title: Data passed to custom filter undefined
body: <p>I'm pretty new to AngularJS, so I'm sorry if I'm asking something stupid (which I'm likely doing).</p>
  
  <p>I have created a custom filter:</p>
  
  <pre><code>angular.module("customFilters", [])
      .filter("mainGroups", function() {
          return function(data) {
              var results = [];
              console.log(data);
              for (var i = 0; i &lt; data.length; i++) {
                  if (data[i].mainGroup == 1 || data[i].mainGroup == 2 || data[i].mainGroup == 3) {
                      results.push(data[i]);
                  }
              }
  
              return results;
          }
      });
  </code></pre>
  
  <p>I'm applying this filter:</p>
  
  <pre><code>ng-options="group.description for group in data.mainGroups.itemMainGroups | mainGroups | orderBy: 'description'"
  </code></pre>
  
  <p>In the console (via console.log) I can clearly see data is an array of 15 objects. <code>Angular.isArray(data)</code> also returns true. Still, I'm getting these errrors:</p>
  
  <pre><code>TypeError: Cannot read property 'length' of undefined
  </code></pre>
  
  <p>What am I doing wrong here?</p>