简体   繁体   English

uib-pagination无法正常工作Angularjs

[英]uib-pagination NOT working Angularjs

EDIT! 编辑!

added more code snippets and plunker updated (AGAIN) 添加了更多代码段并更新了插件(再次)

Still pretty new to Angular and coding in general. 对于Angular和一般的编码来说还是很新的。

I've tried and tried to instantiate the UI Pagination from the Angular Directives website. 我已经尝试从Angular Directives网站实例化UI分页。 I've scoured Stack Overflow and codeProject and various other sites. 我已经搜索了Stack Overflow和codeProject以及其他各种站点。 I can not for the life of me get my pagination to work. 我无法为自己的一生而努力。

I don't know what else to try. 我不知道还能尝试什么。 I'm pretty sure I've called enough properties 我很确定我已经调用了足够的属性

<uib-pagination
    items-per-page="itemsPerPage"
    ng-model="currentPage"
    max-size="maxSize"
    class="pagination-sm"
    next-text="&raquo;"
    previous-text="&laquo;"
    boundary-links="false" >
</uib-pagination>

and running the controller: 并运行控制器:

app.controller('PaginationControl',function ($scope,  $window) {
    // Pagination variables
    $scope.totalItems = 100; //this needs to be changed to represent the total of filtered parks after a search is done and NOT a static number.
    $scope.currentPage = 1;
    $scope.maxSize = 8;
    $scope.itemsPerPage = 10;

}); });

What I don't understand is how to change the pagination properties from static numbers hard coded in the controller to dynamic numbers based off the results of my search. 我不了解的是如何根据搜索结果将分页属性从控制器中硬编码的静态数字更改为动态数字。

Here's a Plunker which has everything but the pagination working. 这是一个Plunker ,除了分页功能 ,其他所有功能都可以使用。

Much obliged 多谢

There were a couple of problems with your plunk. 你的pl子有几个问题。 You referenced the bootstrap.js files instead of the bootstrap.css file. 您引用了bootstrap.js文件而不是bootstrap.css文件。 You referenced the angular core library for version 1.4.5 and the angular animate library for version 1.4.7. 您为版本1.4.5引用了角核库,并为版本1.4.7引用了角动画库。 You reference jQueryUI but not jQuery. 您引用jQueryUI,但不引用jQuery。 You did not set the total-items attribute on the pagination directive. 您没有在分页指令上设置total-items属性。 Here is an updated plunk with the pagination displaying. 这是带有分页显示的更新小插件 Updated reference block: 更新的参考块:

<link href="//netdna.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet">
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.7/angular.min.js"></script>
<script src="https://code.angularjs.org/1.4.7/angular-animate.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular-filter/0.5.8/angular-filter.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular-ui-bootstrap/0.14.3/ui-bootstrap-tpls.min.js"></script>
<script src="script.js"></script> 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM