Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html ng-app>
<head>
<meta name="description" content="Using ng-repeat on tbody to create table groupings" />
<script src="http://cdnjs.cloudflare.com/ajax/libs/angular.js/1.2.1/angular.min.js"></script>
  <meta charset="utf-8">
  <title>JS Bin</title>
</head>
<body ng-controller="Ctrl">
  <table border=1>
    <thead>
      <tr>
        <th>Name</th>
        <th>Gender</th>
      </tr>
    </thead>
    
    <tbody ng-repeat="group in groups">
      <tr>
        <td colspan="2">{{group.name}}</td>
      </tr>
      <tr ng-repeat="member in group.members">
        <td>{{ member.name }}</td>
        <td>{{ member.gender }}</td>
      </tr>
    </tbody>
  </table>
</body>
</html>
 
function Ctrl($scope) {
  $scope.groups = [
    { name: 'Employees', 
      members: [
        { name: 'John', gender: 'M'},
        { name: 'Jane', gender: 'F'}
      ]
    },
    { name: 'Pets',
      members: [
        { name: 'Rex', gender: 'M'},
        { name: 'Lucy', gender: 'F'}
      ]
    }
  ];
}
Output 300px

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
anonymouspro
0viewers