jayeshcp
5/13/2016 - 12:09 AM

JS BinGroupBy example using angular.filter// source http://jsbin.com/vucivacuqa

JS BinGroupBy example using angular.filter// source http://jsbin.com/vucivacuqa

angular.module('app',['angular.filter'])
  .controller('MainController', function($scope) { 
    $scope.players = [
      {
        date: "10-15-2016", 
        data : {
          name : "Jayesh", 
          email: "jaycp@gmail.com"
        }
      },
      {
        date: "10-15-2016", 
        data : {
          name : "Mona", 
          email: "mona.c@gmail.com"
        }
      },
      {
        date: "10-18-2016", 
        data : {
          name : "Bobby", 
          email: "bobby.m@gmail.com"
        }
      }
      
    ];
 });
<!DOCTYPE html>
<html ng-app="app">
<head>
<script src="https://code.jquery.com/jquery.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.22/angular.min.js"></script>
  <script src="http://cdnjs.cloudflare.com/ajax/libs/angular-filter/0.4.7/angular-filter.js"></script>
  
<meta name="description" content="GroupBy example using angular.filter"/>
  <meta charset="utf-8">
  <title>JS Bin</title>
</head>
<body>
  <div ng-controller="MainController"> 
    
<ul ng-repeat="(key, value) in players | groupBy: 'date'" class="list-group">
  <li class="list-group-item active">
    <h4>Group name: {{ key }}</h4>
  </li>
  
  <li ng-repeat="person in value" class="list-group-item">
    person: 
    {{ person.data.name }} <br>
    {{ person.data.email }}
  </li>
</ul>
  </div>
<script id="jsbin-javascript">
angular.module('app',['angular.filter'])
  .controller('MainController', function($scope) { 
    $scope.players = [
      {
        date: "10-15-2016", 
        data : {
          name : "Jayesh", 
          email: "jaycp@gmail.com"
        }
      },
      {
        date: "10-15-2016", 
        data : {
          name : "Mona", 
          email: "mona.c@gmail.com"
        }
      },
      {
        date: "10-18-2016", 
        data : {
          name : "Bobby", 
          email: "bobby.m@gmail.com"
        }
      }
      
    ];
 });
</script>

<script id="jsbin-source-html" type="text/html"><!DOCTYPE html>
<html ng-app="app">
<head>
<script src="https://code.jquery.com/jquery.min.js"><\/script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.22/angular.min.js"><\/script>
  <script src="//cdnjs.cloudflare.com/ajax/libs/angular-filter/0.4.7/angular-filter.js"><\/script>
  
<meta name="description" content="GroupBy example using angular.filter"/>
  <meta charset="utf-8">
  <title>JS Bin</title>
</head>
<body>
  <div ng-controller="MainController"> 
    
<ul ng-repeat="(key, value) in players | groupBy: 'date'" class="list-group">
  <li class="list-group-item active">
    <h4>Group name: {{ key }}</h4>
  </li>
  
  <li ng-repeat="person in value" class="list-group-item">
    person: 
    {{ person.data.name }} <br>
    {{ person.data.email }}
  </li>
</ul>
  </div>
</body>
</html></script>


<script id="jsbin-source-javascript" type="text/javascript">angular.module('app',['angular.filter'])
  .controller('MainController', function($scope) { 
    $scope.players = [
      {
        date: "10-15-2016", 
        data : {
          name : "Jayesh", 
          email: "jaycp@gmail.com"
        }
      },
      {
        date: "10-15-2016", 
        data : {
          name : "Mona", 
          email: "mona.c@gmail.com"
        }
      },
      {
        date: "10-18-2016", 
        data : {
          name : "Bobby", 
          email: "bobby.m@gmail.com"
        }
      }
      
    ];
 });</script></body>
</html>