Angular: Empty Fiddle
http://angularjs.org/
by petermorlion
HTML
<script src="http://code.angularjs.org/angular-1.0.1.js"></script>
<div ng-controller="MyCtrl">
<h1>
Data for {{number}}
</h1>
<table>
<tr ng-repeat="measurement in myDto.data">
<td>{{measurement.distance}}</td>
<td>{{measurement.time}}</td>
</tr>
</table>
</div>
CSS
h1 {
margin: 10px 0;
font-weight: bold;
}
td {
border: 1px solid black;
padding: 10px;
}
JavaScript
var myApp = angular.module('myApp',[]);
function link(scope, element) {
};
myApp.directive('myDirective', function() {
return {
restrict: 'E',
scope: {
data: '='
}
}
});
function MyCtrl($scope) {
$scope.number = 123;
// myDto is an object retrieved from a server
$scope.myDto = {
data: [
{distance: 10, time: 14},
{distance: 15, time: 19},
{distance: 20, time: 22},
{distance: 25, time: 28},
{distance: 35, time: 43}
]
};
}