View difference between Paste ID: CfcSgNM7 and Lm4Wht2x
SHOW: | | - or go back to the newest paste.
1
<!DOCTYPE html>
2
<html ng-app="binding">
3
<head>
4
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.0/angular.min.js" type="text/javascript"></script>
5
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.0/angular-touch.min.js" type="text/javascript"></script>
6
<script type="text/javascript">
7
var app = angular.module("binding", ["ngTouch"]);
8
9
app.controller("bindingCtrl", function($scope) {
10
  $scope.list = [
11
  ];
12
  $scope.list.add = function() {
13
    var item = {
14
      date: new Date(),
15
      number : ("0000" + Math.floor(Math.random() * 10000)).slice(-4)
16
    };
17
    $scope.list.push(item);
18
    console.log($scope.list);
19
  };
20
});
21
</script>
22
</head>
23
<body>
24
<div ng-controller="bindingCtrl">
25
<button ng-click="list.add()">button</button>
26
<table>
27
<tbody>
28
<tr ng-repeat="item in list"><td>{{item.number}}</td><td>{{item.date}}</td></tr>
29
</tbody>
30
</table>
31
</div>
32
</body>
33
</html>