我试图用dirPagination ,但它不工作。 在行动中看到我的代码: http://plnkr.co/edit/18BxNhHRNyRoI17sBGQF?p=preview
我的代码:
<!DOCTYPE html>
<html ng-app="myApp">
<head>
<link data-require="bootstrap-css@3.1.1" data-semver="3.1.1" rel="stylesheet" href="http://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" />
<script data-require="angular.js@1.3.0-beta.5" data-semver="1.3.0-beta.5" src="https://code.angularjs.org/1.3.0-beta.5/angular.js"></script>
<script data-require="jquery@*" data-semver="2.0.3" src="http://code.jquery.com/jquery-2.0.3.min.js"></script>
<script data-require="bootstrap@3.1.1" data-semver="3.1.1" src="http://netdna.bootstrapcdn.com/bootstrap/3.1.1/js/bootstrap.min.js"></script>
<script>
var myApp = angular.module('myApp', [])
.controller('PsCtrl', ['$scope', function ($scope) {
$scope.data = [
{a:1, b:1},
{a:2, b:2},
{a:3, b:3}
];
}]);
</script>
<script src="dirPagination.js"></script>
</head>
<body>
<div ng-controller="PsCtrl">
ItemCount: {{data.length}}
<ul>
<li dir-paginate="item in data | itemsPerPage: 2">{{ item }}</li>
</ul>
<dir-pagination-controls></dir-pagination-controls>
</div>
</body>
</html>
我只得到这样的输出:
ItemCount: 3
⋅
但我希望在底部,这个输出作为第一页分页控件:
ItemCount: 3
⋅ {"a":1,"b":1}
⋅ {"a":2,"b":2}
当我使用<li ng-repeat="item in data">{{ item }}</li>
它显示了正确的列表。
我究竟做错了什么?