我正在尝试跟随这里的分页示例。
我已经能够显示新页面号,但无法触发点击事件。在下面的示例中,我该如何触发data-ng-click="setPage()"
?
<!doctype html>
<html ng-app="PagingModule">
<head>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/angularjs/1.0.5/angular.js"></script>
<script type="text/javascript" src="http://angular-ui.github.io/bootstrap/ui-bootstrap-tpls-0.5.0.js"></script>
<link href="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.3.1/css/bootstrap-combined.min.css"
rel="stylesheet">
<script type="text/javascript">
var PagingModule = angular.module('PagingModule', ['ui.bootstrap']);
PagingModule.controller('PaginationCtrl', function PaginationCtrl($scope) {
$scope.noOfPages = 7;
$scope.currentPage = 1;
$scope.setPage = function () {
alert("in");//I am unable to reach this code
};
}
);
</script>
</head>
<body>
<div ng-controller="PaginationCtrl" class="well well-small">
<pagination data-ng-click="setPage()" boundary-links="true" num-pages="noOfPages"
current-page="currentPage" class="pagination-small" previous-text="‹"
next-text="›" first-text="«" last-text="»"></pagination>
{{currentPage}}
</div>
</body>
</html>
on-select-page
已被移除(参见https://github.com/angular-ui/bootstrap/commit/d65901cff87ab895df997a803222f94ac223e9d3)。`on-select-page`现在改为使用`ng-change`。 - Jared Eitnier