title: AngularJS orderby with array of arrays and separate keys
body: <p>I have tabular data that I'm returning from the server in the form of an array of arrays for the data, and an array of keys associated with that data. Then, I want to sort by a particular key. Now, I know I can pre-process the data and zip together an array of objects, but say I don't want to do that. Is there an easy, built-in way to do this?</p>
  
  <p>Some code that doesn't actually sort but does display the data. <a href="http://codepen.io/radusuciu/pen/vweaf" rel="nofollow">CodePen</a>.</p>
  
  <p>JS:</p>
  
  <pre><code>var app = angular.module('helloworld', []);
  
  app.controller('TestController', function() {
    this.headers = ['foo', 'bar'];
    this.data = [
      [ 'lol', 'wut' ],
      [ '123', 'abc' ]
    ];
  
    this.predicate = '';
  });
  </code></pre>
  
  <p>HTML:</p>
  
  <pre><code>&lt;table ng-app="helloworld" ng-controller="TestController as test"&gt;
    &lt;thead&gt;
      &lt;tr&gt;
        &lt;th ng-repeat="heading in test.headers" ng-click="test.predicate = heading"&gt;{{ heading }}&lt;/th&gt;
      &lt;/tr&gt;
    &lt;/thead&gt;
    &lt;tbody&gt;
      &lt;tr&gt;
        &lt;td&gt;Predicate:&lt;/td&gt;
        &lt;td&gt;{{ test.predicate }}&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr ng-repeat="row in test.data | orderBy: test.predicate"&gt;
        &lt;td ng-repeat="column in row"&gt;{{ column }}&lt;/td&gt;
      &lt;/tr&gt;
    &lt;/tbody&gt;
  &lt;/table&gt;
  </code></pre>