-
Notifications
You must be signed in to change notification settings - Fork 5
/
20. Search_filter.html
64 lines (50 loc) · 956 Bytes
/
20. Search_filter.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Angular functions transform into filter</title>
</head>
<body>
<div ng-app="myApp">
<div class="" ng-controller="empCtrl">
<input type="text" ng-model="search.name"> <!--search.$-->
<table>
<!--
orderBy: '-name'
limitTo: 5 / -5
-->
<tr ng-repeat="emp in employee.lists | filter: search | orderBy: 'name'">
<td>{{emp.name | lowercase}}</td>
<td>{{emp.team | uppercase}}</td>
</tr>
</table>
</div>
</div>
<script src="src/angular.1.3.min.js"></script>
<script>
var myApp = angular.module('myApp', []);
myApp.factory('Employee', function(){
var employee = {};
// JSON
employee.lists = [
{
name: 'James',
team: 'hww'
},
{
name: 'Smith',
team: 'nokia'
},
{
name: 'John',
team: 'abu'
}
];
return employee;
});
function empCtrl($scope, Employee){
$scope.employee = Employee;
}
</script>
</body>
</html>