-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathex8.html
More file actions
32 lines (31 loc) · 889 Bytes
/
ex8.html
File metadata and controls
32 lines (31 loc) · 889 Bytes
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
<!DOCTYPE html>
<html ng-app="countryTableApp">
<script src="angular.min.js"></script>
<script type="text/javascript">
var app = angular.module('countryTableApp', []);
app.controller('myCtrl', function($scope, $http) {
$http.get('countries.json').then(function(cty) {
$scope.countries = cty.data;
});
});
</script>
<body>
<div ng-controller="myCtrl">
Search: <input type="text" ng-model="searchType">
<table>
<thead>
<tr>
<th><a href="" ng-click="sortField = 'country'; reverse = !reverse">Country Name</a></th>
<th><a href="" ng-click="sortField = 'population'; reverse = !reverse">Population</a></th>
</tr>
</thead>
<tbody>
<tr ng-repeat="country in countries | filter:searchType | orderBy:sortField:reverse ">
<td>{{country.country}}</td>
<td>{{country.population}}</td>
</tr>
</tbody>
</table>
</div>
</body>
</html>