-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathangular_table.html
More file actions
96 lines (92 loc) · 2.41 KB
/
angular_table.html
File metadata and controls
96 lines (92 loc) · 2.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<script type="text/javascript" src="./js/angular.js"></script>
<title>angular table</title>
<style>
table, td {
border: 1px solid grey;
border-collapse: collapse;
padding: 5px;
}
</style>
</head>
<body>
<div ng-app="myApp" ng-controller="customersCtrl">
<table>
<tr ng-repeat="x in names">
<td style="{{$even?'background-color: #f1f1f1':''}}">{{$index + 1}}</td>
<td style="{{$even?'background-color: #f1f1f1':''}}">{{ x.Name }}</td>
<td style="{{$even?'background-color: #f1f1f1':''}}">{{ x.Country
}}
</td>
</tr>
</table>
</div>
</body>
</html>
<script>
var namedata = [
{
"Name": "Alfreds Futterkiste",
"Country": "Germany"
},
{
"Name": "Ana Trujillo Emparedados y helados",
"Country": "Mexico"
},
{
"Name": "Antonio Moreno Taquería",
"Country": "Mexico"
},
{
"Name": "Around the Horn",
"Country": "UK"
},
{
"Name": "B's Beverages",
"Country": "UK"
},
{
"Name": "Berglunds snabbköp",
"Country": "Sweden"
},
{
"Name": "Blauer See Delikatessen",
"Country": "Germany"
},
{
"Name": "Blondel père et fils",
"Country": "France"
},
{
"Name": "Bólido Comidas preparadas",
"Country": "Spain"
},
{
"Name": "Bon app'",
"Country": "France"
},
{
"Name": "Bottom-Dollar Marketse",
"Country": "Canada"
},
{
"Name": "Cactus Comidas para llevar",
"Country": "Argentina"
},
{
"Name": "Centro comercial Moctezuma",
"Country": "Mexico"
}
]
var app = angular.module('myApp', []);
app.controller('customersCtrl', function ($scope, $http) {
$scope.names = namedata;
/*$http.get("/try/angularjs/data/Customers_JSON.php")
.then(function (result) {
$scope.names = result.data.records;
});*/
});
</script>