一、绑定
<html ng-app="lesson" ng-controller="lesson4">
<table>
<thead><th>姓名</th><th>年龄</th><th>星座</th><th>工作年限</th></thead>
<tbody>
<tr ng-repeat="x in UserEntityList">
<td>{{x.Name}}</td><td>{{x.Age}}</td><td>{{x.Constellation}}</td><td>{{x.WorkYear}}</td>
</tr>
</tbody>
</table>
<script src=”scripts/angular-1.1.1.min.js“></script>
<script>
var app = angular.module("lesson",[]);
app.controller("lesson4",function($scope){
$scope.UserEntityList=[
{'Name':'Tom','Age':26,'Constellation':'水瓶座','WorkYear':19},
{'Name':'Jerry','Age':27,'Constellation':''巨蟹座','WorkYear':5},
{'Name':'David','Age':28,'Constellation':''天秤座','WorkYear':6},
{'Name':'Tim','Age':39,'Constellation':''摩羯座','WorkYear':7}
]
})
</script>
二、过滤器
1、排序
正序:<tr ng-repeat="x in UserEntityList | orderBy:'Age'">
倒序:<tr ng-repeat="x in UserEntityList | orderBy:'Age':true">
2、组合排序
正序:<tr ng-repeat="x in UserEntityList | orderBy:['Age','WorkYear']">
倒序:<tr ng-repeat="x in UserEntityList | orderBy:['Age','-WorkYear']">
3、大写输出
{{x.Name | uppercase}}
4、序号
<tr ng-repeat="x in UserEntityList">
{{ $index }}
</tr>
5、过滤器
显示带39的(模糊查询):<tr ng-repeat="x in UserEntityList | orderBy:['Age','WorkYear'] | filter:39">
显示39的(精准查询):<tr ng-repeat="x in UserEntityList | orderBy:['Age','WorkYear'] | filter:{‘Age’:39}">