<!DOCTYPE html>
<html>
<head>
<script data-require="angular.js@1.2.8" data-semver="1.2.8" src="http://code.angularjs.org/1.2.8/angular.js"></script>
<script src="script.js"></script>
<link href="//netdna.bootstrapcdn.com/bootstrap/3.0.3/css/bootstrap.min.css" rel="stylesheet" data-semver="3.0.3" data-require="bootstrap-css@3.0.3" />
<link href="style.css" rel="stylesheet" />
</head>
<body ng-app="myApp">
<div ng-controller="tableCtrl">
<h1>ngRepeat Plunker</h1>
<h2>Data properties</h2>
<label>
Columns:
<input type="number" ng-model="columns" />
</label>
<label>
Rows:
<input type="number" ng-model="rows" />
</label>
<label>
<input type="checkbox" ng-model="showSelectionBox" />
Selection
</label>
<button ng-click="generateData()">New data</button>
<h2>Table</h2>
<table class="table table-striped">
<thead>
<tr>
<th ng-repeat="col in columns">{{col.title}}</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="row in data" ng-class="{ selected: row.isSelected }">
<td ng-repeat="col in columns">
<span ng-hide="col.template">{{row[col.field]}}</span>
<div ng-include="col.template"></div>
</td>
</tr>
</tbody>
</table>
</div>
</body>
</html>
(function(angular) {
'use strict';
angular.module('myApp', ['ng'])
.controller('tableCtrl', ["$scope",
function tableCtrl($scope) {
$scope.rows = 30;
$scope.columns = 10;
$scope.showSelectionBox = true;
$scope.generateData = function() {
var i, c;
var newData = [];
for (i = 0; i < $scope.rows; ++i) {
var o = {
id: i,
isSelected: false
};
for (c = 0; c < $scope.columns; ++c)
o['c' + c] = 'Data(' + i + ',' + c + ')';
newData.push(o);
}
var newColumns = [
{
title: '#',
field: 'id'
}
];
if ($scope.showSelectionBox)
newColumns.unshift({
title: '',
template: 'selection.partial.html'
});
for (c = 0; c < $scope.columns; ++c)
newColumns.push({
title: 'Col' + c,
field: 'c' + c
});
$scope.data = newData;
$scope.columns = newColumns;
};
$scope.generateData();
}]
);
}(angular));
/* Styles go here */
.selected {
border: 2px solid gray;
}
Sample plunker to show when browser stop responding properly to data changes inside a table
<input type="checkbox" ng-data="row.isSelected" />