HTML
<!DOCTYPE html>
<html ng-app=EmployeeApp>
<head>
<script data-require="angular.js@1.2.0-rc3" data-semver="1.2.0-rc3" src="http://code.angularjs.org/1.2.0-rc.3/angular.min.js"></script>
<link rel="stylesheet" href="style.css" />
<script src="script.js"></script>
</head>
<body ng-controller="empCtrl">
<table>
<tr>
<td align="right">Search :</td>
<td><input ng-model="query[queryBy]" /></td>
</tr>
<tr>
<td align="right">Search By :</td>
<td>
<select ng-model="queryBy">
<option value="$"></option>
<option value="name">NAME</option>
<option value="company">COMPANY</option>
<option value="Number">Number of Employees</option>
</select>
</td>
</tr>
</table>
<hr>
<div>
<table>
<tr>
<th>Employee Name</th>
<th>Company Name</th>
<th>Number of Employees</th>
</tr>
<tr ng-repeat="emp in employees | filter:query">
<td>{{emp.name}}</td>
<td>{{emp.company}}</td>
<td>{{emp.Number}}</td>
</tr>
</table>
</div>
</body>
</html>
JS代码
var employeeApp = angular.module("EmployeeApp",[]);
employeeApp.controller("empCtrl",function($scope){
$scope.query = {}
$scope.queryBy = '$'
$scope.employees = [
{
"name" : "Mahesh Pachangane",
"company" : "Syntel India Pvt. Ltd",
"Number" : 10
},
{
"name" : "Brijesh Shah",
"company" : "Britanica Software Ltd.",
"Number" : 15
},
{
"name" : "Brijh Shah",
"company" : "hi Software Ltd.",
"Number" : 11
}
];
$scope.orderProp="name";
});
使用这两个代码,我可以过滤等于表中特定属性值的数据。如何确定小于,大于,不等于特定值的数据?有没有我可以使用的插件?