-
Notifications
You must be signed in to change notification settings - Fork 0
/
relation.html
50 lines (50 loc) · 1.19 KB
/
relation.html
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
<!DOCTYPE html>
<html ng-app="myInsured">
<head>
<title>Example to display JSON data in a Table using AngularJS?</title>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.0-rc.0/angular.min.js"></script>
<script type="text/javascript">
var myInsured = angular.module('myInsured', []);
myInsured.controller('insuredCtrl', function($scope, $http) {
$http.get("./insured.json").success(function (response) {
/*After Successfully fetch the data from JSON file assigning these data to $scope object variable*/
$scope.members = response.insureds;
});
});
</script>
<style type="text/css">
/*Style for Table*/
table, th , td {
border: 1px solid grey;
border-collapse: collapse;
padding: 4px;
font-family: arial;
}
/*Style for Table Header*/
th {
background: darkblue;
color: white;
text-align: left;
}
/*Style for Alternate Rows*/
table tr:nth-child(odd) {
background-color: #C2EBC3;
}
table tr:nth-child(even) {
background-color: #FFFFFF;
}
</style>
</head>
<body ng-controller="insuredCtrl">
<table>
<tr>
<th>Name</th>
<th>Relationship</th>
</tr>
<tr ng-repeat="indivisual in members">
<td>{{ indivisual.Name }}</td>
<td>{{ indivisual.Relation }}</td>
</tr>
</table>
</body>
</html>