title: How to the group by with 2 columns in Angular filter using AngularJS
body: <p>I have an array of an object having 3 properties name</p>
  
  <p>1.name
  2.team
  3.age</p>
  
  <p><a href="http://jsfiddle.net/HpTDj/46/" rel="nofollow noreferrer">http://jsfiddle.net/HpTDj/46/</a></p>
  
  <p>I want group with both age and team.i done group with team but i have confusion how i need to group with both team and age in my current code.</p>
  
  <p>I need to show the age of the team with the team name. Please suggest what should I do?</p>
  
  <p><strong>JS:</strong></p>
  
  <pre><code> $scope.MyList = [
      {name: 'Gene', team: 'alpha', age: 19},
        {name: 'George', team: 'beta', age: 19},
        {name: 'Steve', team: 'gamma', age: 23},
        {name: 'Paula', team: 'beta', age: 23},
        {name: 'Scruath', team: 'gamma', age: 23},
        {name: 'Scruath 1', team: 'gamma', age: 22},
        {name: 'Scruath 2', team: 'gamma', age: 22}
                      ];
      $scope.getGroups = function () {
          var groupArray = [];
          angular.forEach($scope.MyList, function (item, idx) {
              if (groupArray.indexOf(item.team) == -1){ groupArray.push(item.team)
              }
          });
          return groupArray.sort();
      }
  </code></pre>
  
  <p><strong>HTML:</strong></p>
  
  <pre><code>  &lt;div ng-repeat='group in getGroups()'&gt;
               &lt;h2&gt;{{group}}&lt;/h2&gt;
                &lt;ul&gt;
                  &lt;li ng-repeat="item in MyList |  groupby:group"&gt;{{item.name}}&lt;/li&gt;
              &lt;/ul&gt;
          &lt;/div&gt;
  </code></pre>