var app = angular.module('plunker', []);
app.controller('MainCtrl', function($scope) {
$scope.keys = function() {
var keys = [];
for(key in $scope.contents[0])
{
if(key != '$$hashKey'){
keys.push(key);
}
}
return keys;
}
$scope.contents = [
{
id : '1231',
session: '1231-1231-2392-1223',
expires: '2013-05-26T18:35Z'
},
{
id : '3234',
session: '1231-1231-2392-1223',
expires: '2013-05-13T18:35Z'
},
{
id : '2432',
session: '23234-234-23423-23423',
expires: '2012-03-23T12:35Z'
}
]
});
<!DOCTYPE html>
<html ng-app="plunker">
<head>
<meta charset="utf-8">
<title>AngularJS Plunker</title>
<script>
document.write('<base href="' + document.location + '" />');
</script>
<link rel="stylesheet" href="style.css">
<script data-require="angular.js@1.0.x" src="http://code.angularjs.org/1.0.7/angular.min.js" data-semver="1.0.7"></script>
<script src="app.js"></script>
</head>
<body ng-controller="MainCtrl">
<table class="table table-striped">
<caption>Content</caption>
<thead>
<tr>
<th ng-repeat="key in keys()">
{{key}}
</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="content in contents | orderBy:'id':false">
<td>
{{content.id}}
</td>
<td>
{{content.session}}
</td>
<td>
{{content.expires | date}}
</td>
</tr>
</tbody>
</table>
</html>
/* Put your css in here */