-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfilterSearch.html
47 lines (35 loc) · 1.46 KB
/
filterSearch.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
<html>
<title>Angular Demo</title>
<link rel=stylesheet href="https://cdnjs.cloudflare.com/ajax/libs/foundation/6.3.1/css/foundation.css"/>
<body ng-app="myApp">
<div ng-controller="AppCtrl">
<button ng-click="loadData()">Load</button>
<input type="text" ng-model="search.name" placeholder="Search by Name"/>
<input type="text" ng-model="search.role" placeholder="Search by Role"/>
<input type="text" ng-model="search.$" placeholder="Search Anything"/>
<div>
<ul ng-repeat="employee in employees | filter: search ">
<li>{{employee.id}}</li>
<li>{{employee.name | uppercase}}</li>
<li>{{employee.role}}</li>
</ul>
</div>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.2/angular.min.js"></script>
<script>
var app = angular.module('myApp', [])
app.controller('AppCtrl', function($scope, $http){
console.log($scope)
$scope.loadData = function(){
$http({
url: 'data.json',
method: 'GET'
}).then(function(res){
console.log(res)
$scope.employees = res.data
})
}
})
</script>
</body>
</html>