limitTo 限制顯示筆數
<script src="~/Scripts/ngcontroller.js"></script>
<div ng-app="myModule">
<div ng-controller="myController">
<input type="number" ng-model="limitRows" />
<table border="1">
<thead>
<tr>
<th>name</th>
<th>dateofBirth</th>
<th>gender</th>
<th>salary</th>
<th>salary</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="a in employees | limitTo:limitRows">
<td>{{a.name | uppercase}}</td>
<td>{{a.dateofBirth | date:"yyyy/MM/dd" }}</td>
<td>{{a.gender | lowercase}}</td>
<td>{{a.salary | number:2 }}</td>
<td>{{a.salary | currency }}</td>
</tr>
</tbody>
</table>
</div>
</div>
var myApp = angular.module("myModule", []);
myApp.controller("myController", function ($scope) {
var employees = [{
name: "Ben", dateofBirth: new Date("November 23 1980")
, gender: "Male", salary: 55000.788
}
, {
name: "Ben", dateofBirth: new Date("November 23 1980")
, gender: "Male", salary: 55000.788
}
, {
name: "Sara", dateofBirth: new Date("May 05 1970")
, gender: "FeMale", salary: 68000
}
, {
name: "Mark", dateofBirth: new Date("August 15 1974")
, gender: "Male", salary: 57000
}
, {
name: "Pam", dateofBirth: new Date("October 27 1979")
, gender: "FeMale", salary: 53000
}];
$scope.employees = employees;
$scope.limitRows = 3;
});