title: How to use orderBy and filter when some contents from other JSON objects
body: <p>How can I filter and search the <strong>item name</strong> when the item details are coming from another JSON object ? </p>
  
  <p>Demo: <a href="http://codepen.io/anon/pen/GjAxKX" rel="nofollow">http://codepen.io/anon/pen/GjAxKX</a></p>
  
  <p>The rest of the filter and orderBy working fine, but I couldn't find solution for the <strong>item</strong> part for <code>orderBy</code> and <code>filter</code> </p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>angular.module('mytodos', ['ui.bootstrap']).controller('TodoController', function($scope) {
    $scope.changeNum = function(itemNum) {
      $scope.numPerPage = itemNum;
    };
  
    $scope.numsForPage = [5, 10, 25, 50, 100];
    $scope.currentPage = 1;
    $scope.numPerPage = 5;
    $scope.maxSize = 5;
  
    // Sort
    $scope.changeSort = function(item) {
      $scope.reverse = $scope.reverse = !$scope.reverse;
      $scope.sort = item;
    };
  
    $scope.filteredTodos = [];
    $scope.currentPage = 1;
    $scope.numPerPage = 5;
    $scope.maxSize = 5;
    $scope.expenses = [{
      "id": 1,
      "name": "Warren Phillips",
      "amount": "37.47",
      "date": "12/11/2015",
      "item": 1,
      "description": "blandit. Nam nulla magna, malesuada vel, convallis in, cursus et, eros. Proin ultrices. Duis volutpat nunc sit amet metus. Aliquam erat volutpat. Nulla facilisis. Suspendisse commodo tincidunt nibh. Phasellus nulla. Integer vulputate, risus a ultricies adipiscing, enim mi tempor lorem, eget mollis lectus pede et risus. Quisque libero lacus, varius et, euismod et, commodo at, libero. Morbi accumsan"
    }, {
      "id": 2,
      "name": "Declan Ayala",
      "amount": "29.18",
      "date": "12/17/2014",
      "item": 3,
      "description": "Integer eu lacus. Quisque imperdiet, erat nonummy ultricies ornare, elit elit fermentum risus, at fringilla purus mauris a nunc. In at pede. Cras"
    }, {
      "id": 3,
      "name": "Ivana Bell",
      "amount": "88.53",
      "date": "11/20/2014",
      "item": 3,
      "description": "Etiam imperdiet dictum magna. Ut tincidunt orci quis lectus. Nullam suscipit, est ac facilisis facilisis, magna tellus faucibus leo, in lobortis tellus justo sit amet nulla."
    }, {
      "id": 4,
      "name": "Brennan Noel",
      "amount": "17.76",
      "date": "02/06/2015",
      "item": 6,
      "description": "velit eu sem. Pellentesque ut ipsum ac mi eleifend egestas. Sed pharetra, felis"
    }, {
      "id": 5,
      "name": "Thomas Tran",
      "amount": "29.59",
      "date": "08/20/2014",
      "item": 3,
      "description": "nisl sem, consequat nec, mollis vitae, posuere at, velit. Cras lorem lorem, luctus ut, pellentesque eget, dictum placerat, augue. Sed molestie. Sed id risus quis diam luctus lobortis. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos hymenaeos. Mauris ut quam vel sapien imperdiet ornare."
    }, {
      "id": 6,
      "name": "Tucker Bolton",
      "amount": "66.69",
      "date": "12/09/2014",
      "item": 4,
      "description": "et risus. Quisque libero lacus, varius et, euismod et, commodo at, libero. Morbi accumsan laoreet ipsum. Curabitur consequat, lectus sit amet luctus vulputate, nisi sem semper erat, in consectetuer ipsum nunc id enim. Curabitur massa. Vestibulum accumsan neque et nunc. Quisque ornare tortor at risus. Nunc ac sem ut dolor dapibus gravida. Aliquam tincidunt, nunc ac mattis ornare, lectus ante dictum mi, ac mattis velit justo nec ante. Maecenas mi felis, adipiscing fringilla, porttitor vulputate, posuere vulputate, lacus. Cras interdum."
    }, {
      "id": 7,
      "name": "Medge Mullen",
      "amount": "23.78",
      "date": "10/17/2015",
      "item": 4,
      "description": "dictum mi, ac mattis velit justo nec ante. Maecenas mi felis, adipiscing fringilla, porttitor vulputate, posuere vulputate, lacus. Cras interdum. Nunc sollicitudin commodo ipsum. Suspendisse non leo. Vivamus nibh dolor, nonummy ac, feugiat non, lobortis quis, pede. Suspendisse dui. Fusce diam nunc, ullamcorper eu, euismod ac, fermentum vel, mauris. Integer sem elit, pharetra ut, pharetra sed, hendrerit a, arcu. Sed et"
    }, {
      "id": 8,
      "name": "Morgan Merritt",
      "amount": "54.09",
      "date": "04/10/2016",
      "item": 2,
      "description": "Nulla facilisis. Suspendisse commodo tincidunt nibh. Phasellus nulla. Integer vulputate, risus a ultricies adipiscing, enim mi tempor lorem, eget mollis lectus pede et risus. Quisque libero lacus, varius et, euismod et,"
    }, {
      "id": 9,
      "name": "Janna Casey",
      "amount": "22.61",
      "date": "08/05/2015",
      "item": 1,
      "description": "eros turpis non enim. Mauris quis turpis vitae purus gravida sagittis. Duis gravida. Praesent eu nulla at sem molestie sodales. Mauris blandit enim consequat purus. Maecenas libero est, congue a, aliquet vel, vulputate eu, odio. Phasellus at augue id ante dictum"
    }, {
      "id": 10,
      "name": "Buffy Best",
      "amount": "59.98",
      "date": "05/06/2015",
      "item": 5,
      "description": "lacus vestibulum lorem, sit amet ultricies sem magna nec quam. Curabitur vel lectus. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec dignissim magna a tortor. Nunc commodo auctor velit. Aliquam nisl. Nulla eu neque pellentesque massa lobortis ultrices. Vivamus rhoncus. Donec est. Nunc ullamcorper, velit in aliquet lobortis, nisi nibh lacinia orci, consectetuer euismod est arcu ac orci. Ut semper pretium neque. Morbi quis urna."
    }, {
      "id": 11,
      "name": "Brielle Newman",
      "amount": "52.26",
      "date": "04/16/2016",
      "item": 4,
      "description": "placerat, augue. Sed molestie. Sed id risus quis diam luctus lobortis."
    }, {
      "id": 12,
      "name": "Julie James",
      "amount": "6.38",
      "date": "08/15/2014",
      "item": 3,
      "description": "placerat, orci lacus vestibulum lorem, sit amet ultricies sem magna nec quam. Curabitur vel lectus. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec dignissim magna a tortor. Nunc commodo auctor velit. Aliquam nisl. Nulla eu neque"
    }, {
      "id": 13,
      "name": "Shaine Barnett",
      "amount": "0.04",
      "date": "09/29/2014",
      "item": 5,
      "description": "laoreet, libero et tristique pellentesque, tellus sem mollis dui, in sodales elit erat vitae risus. Duis a mi fringilla mi lacinia mattis. Integer eu lacus. Quisque imperdiet, erat nonummy ultricies ornare, elit elit fermentum risus, at fringilla purus mauris a nunc. In at pede. Cras vulputate velit eu sem. Pellentesque ut ipsum ac mi eleifend egestas. Sed"
    }, {
      "id": 14,
      "name": "Genevieve Underwood",
      "amount": "50.71",
      "date": "09/24/2015",
      "item": 6,
      "description": "consequat auctor, nunc nulla vulputate dui, nec tempus mauris erat eget ipsum. Suspendisse sagittis. Nullam vitae diam. Proin dolor. Nulla semper"
    }, {
      "id": 15,
      "name": "Adam Villarreal",
      "amount": "18.48",
      "date": "04/06/2016",
      "item": 2,
      "description": "nisl. Maecenas malesuada fringilla est. Mauris eu turpis. Nulla aliquet. Proin velit. Sed malesuada augue ut lacus. Nulla tincidunt, neque vitae semper egestas, urna justo faucibus lectus, a sollicitudin orci sem eget massa. Suspendisse eleifend. Cras sed leo. Cras vehicula aliquet libero. Integer in magna. Phasellus dolor elit, pellentesque a, facilisis non, bibendum sed, est. Nunc laoreet lectus quis massa. Mauris"
    }];
    $scope.theItems = {
      1: {
        'name': 'TV',
        'models': [1]
      },
      2: {
        'name': 'Radio',
        'models': [2, 3, 4, 5]
      },
      3: {
        'name': 'Mobile',
        'models': [6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26]
      },
      4: {
        'name': 'Tablet',
        'models': [27, 28, 29, 30]
      },
      5: {
        'name': 'Camera',
        'models': [31, 32, 33, 34, 35, 36, 37, 38, 39]
      },
      6: {
        'name': 'Speaker',
        'models': [40]
      }
    }
  }).filter('pagination', function() {
    return function(input, currentPage, pageSize) {
      if (angular.isArray(input)) {
        var start = (currentPage - 1) * pageSize;
        var end = currentPage * pageSize;
        return input.slice(start, end);
      }
    };
  });</code></pre>
  <pre class="snippet-code-css lang-css prettyprint-override"><code>.box {
    border: 1px solid #DDD;
    padding: 10px;
    position: relative;
    background: #FFF;
    margin: 0 0 10px;
  }
  .tab-content &gt; .tab-pane &gt; .box {
    border-top: none;
  }
  .tab-content &gt; .box {
    border-top: none;
  }
  select.pagiantion{
    width: auto;
    display: inline-block;
  }
  .box{
    th{
      cursor: pointer;
    }
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"&gt;
  &lt;script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.5.8/angular.min.js"&gt;&lt;/script&gt;
  &lt;script src="https://angular-ui.github.io/bootstrap/ui-bootstrap-tpls-0.12.1.min.js"&gt;&lt;/script&gt;
  &lt;div ng-app="mytodos" ng-controller="TodoController"&gt;
    &lt;div class="container"&gt;
      &lt;hr /&gt;
      &lt;tabset&gt;
        &lt;tab&gt;
          &lt;tab-heading&gt;Statement &lt;/tab-heading&gt;
          &lt;div class="box"&gt;
            &lt;h1&gt;Todos&lt;/h1&gt;
            &lt;h4&gt;{{expenses.length}} total&lt;/h4&gt;
            &lt;div class="row"&gt;
              &lt;div class="col-md-6"&gt;
                &lt;label for=""&gt;Show 
              &lt;select class="form-control pagiantion" ng-model="numPerPage" ng-options="numPage for numPage in numsForPage" ng-change="changeNum(numPerPage);"&gt;&lt;/select&gt;
              entries
            &lt;/label&gt;
              &lt;/div&gt;
            &lt;/div&gt;
            &lt;table class="table table-hover table-responsive table-bordered"&gt;
              &lt;thead&gt;
                &lt;tr&gt;
                  &lt;th ng-click="changeSort('name')"&gt;Name &lt;span class="glyphicon pull-right" ng-class="sort == 'name' ? (reverse ? 'glyphicon-sort-by-attributes-alt' : 'glyphicon-sort-by-attributes') : 'glyphicon-sort' "&gt;&lt;/span&gt;&lt;/th&gt;
                  &lt;th ng-click="changeSort('amount')"&gt;Amount &lt;span class="glyphicon pull-right" ng-class="sort == 'amount' ? (reverse ? 'glyphicon-sort-by-attributes-alt' : 'glyphicon-sort-by-attributes') : 'glyphicon-sort' "&gt;&lt;/span&gt;&lt;/th&gt;
                  &lt;th ng-click="changeSort('date')"&gt;Date &lt;span class="glyphicon pull-right" ng-class="sort == 'date' ? (reverse ? 'glyphicon-sort-by-attributes-alt' : 'glyphicon-sort-by-attributes') : 'glyphicon-sort' "&gt;&lt;/span&gt;&lt;/th&gt;
                  &lt;th ng-click="changeSort('item')"&gt;Date &lt;span class="glyphicon pull-right" ng-class="sort == 'date' ? (reverse ? 'glyphicon-sort-by-attributes-alt' : 'glyphicon-sort-by-attributes') : 'glyphicon-sort' "&gt;&lt;/span&gt;&lt;/th&gt;
                &lt;/tr&gt;
                &lt;tr&gt;
                  &lt;th&gt;
                    &lt;input 
                           type="text" 
                           class="form-control" 
                           placeholder="Name" 
                           ng-model="filterlist.name"/&gt;
                  &lt;/th&gt;
                  &lt;th&gt;
                    &lt;input 
                           type="text" 
                           class="form-control" 
                           placeholder="Amount" 
                           ng-model="filterlist.amount"/&gt;
                  &lt;/th&gt;
                  &lt;th&gt;
                    &lt;input 
                           type="text" 
                           class="form-control" 
                           placeholder="Date" 
                           ng-model="filterlist.date"/&gt;
                  &lt;/th&gt;
                  &lt;th&gt;
                    &lt;input 
                           type="text" 
                           class="form-control" 
                           placeholder="Item" 
                           ng-model="filterlist.item"/&gt;
                  &lt;/th&gt;
                &lt;/tr&gt;
              &lt;/thead&gt;
              &lt;tbody&gt;
                &lt;tr ng-repeat="expense in filteredlist = (expenses | filter:filterlist) | orderBy:sort:reverse | pagination: currentPage : numPerPage"&gt;
                  &lt;td&gt;{{expense.name}}&lt;/td&gt;
                  &lt;td&gt;{{expense.amount}}&lt;/td&gt;
                  &lt;td&gt;{{expense.date}}&lt;/td&gt;
                  &lt;td&gt;{{theItems[expense.item].name}}&lt;/td&gt;
                &lt;/tr&gt;
              &lt;/tbody&gt;
            &lt;/table&gt;
            &lt;div class="clearfix" ng-show="expenses.length &gt; numPerPage"&gt;
              &lt;pagination 
                          ng-model="currentPage" 
                          total-items="filteredlist.length" 
                          max-size="maxSize" 
                          items-per-page="numPerPage" 
                          boundary-links="true" 
                          class="pagination-sm pull-right" 
                          ng-hide="filteredlist.length &lt; numPerPage" previous-text="&amp;lsaquo;" 
                          next-text="&amp;rsaquo;" 
                          first-text="&amp;laquo;" 
                          last-text="&amp;raquo;"
                          &gt;&lt;/pagination&gt;
            &lt;/div&gt;
          &lt;/div&gt;
        &lt;/tab&gt;
      &lt;/tabset&gt;
    &lt;/div&gt;
  &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>