实例代码“Ctrl+/”提示“F11/ESC”全屏 返回 格式化 恢复 运行
x
 
1
<!DOCTYPE html>
2
<html>
3
<style>
4
table, th , td  {
5
  border: 1px solid grey;
6
  border-collapse: collapse;
7
  padding: 5px;
8
}
9
table tr:nth-child(odd) {
10
  background-color: #f1f1f1;
11
}
12
table tr:nth-child(even) {
13
  background-color: #ffffff;
14
}
15
</style>
16
<script src="https://apps.bdimg.com/libs/angular.js/1.3.9/angular.min.js"></script>
17
<body>
18
19
<div ng-app="myApp" ng-controller="customersCtrl"> 
20
21
<table>
22
  <tr ng-repeat="x in names">
23
    <td>{{ $index + 1 }}</td>
24
    <td>{{ x.Name }}</td>
25
    <td>{{ x.Country }}</td>
26
  </tr>
27
</table>
28
29
</div>
30
31
<script>
32
var app = angular.module('myApp', []);
33
app.controller('customersCtrl', function($scope, $http) {
34
    $http.get("/static/example/Customers_JSON.php")
35
    .success(function (response) {$scope.names = response.records;});
36
});
37
</script>
38
39
</body>
40
</html>
41