简体   繁体   English

如何从分页指令angularjs隐藏直接页面链接?

[英]how to hide direct page links from Pagination Directive angularjs?

I am using this Pagination directive 我正在使用此分页指令

https://github.com/michaelbromley/angularUtils/blob/master/src/directives/pagination/README.md https://github.com/michaelbromley/angularUtils/blob/master/src/directives/pagination/README.md

I want hide direct pages links(1,2,3) only need next and previous how to do that ? 我想隐藏直接页面链接(1,2,3)只需要下一个和上一个怎么做? I am using this code 我正在使用此代码

http://plnkr.co/edit/Wtkv71LIqUR4OhzhgpqL?p=preview http://plnkr.co/edit/Wtkv71LIqUR4OhzhgpqL?p=preview

<div ng-controller="OtherController" class="other-controller">
          <small>this is in "OtherController"</small>
          <div class="text-center">
          <dir-pagination-controls boundary-links="true" on-page-change="pageChangeHandler(newPageNumber)" template-url="dirPagination.tpl.html"></dir-pagination-controls>
          </div>
        </div>

You could use uib-pager directive which is precisely defined for this purpose. 您可以使用为此目的专门定义的uib-pager指令。 This directive supports all the attributes of uib-pagination directive. 该指令支持uib-pagination指令的所有属性。

<uib-pager total-items="totalItems" ng-model="currentPage" align=false></uib-pager>

see documentation 请参阅文件

Here is an example of a custom template which uses the range values along with "previous" and "next" arrow links, but no page links: 这是一个自定义模板的示例,该模板使用范围值以及“上一个”和“下一个”箭头链接,但没有页面链接:

<div class="range-label">Displaying {{ range.lower }} - {{ range.upper }} of {{ range.total }}</div>
<a href="" title="Previous page" ng-class="{ disabled : pagination.current == 1 }" ng-click="setCurrent(pagination.current - 1)">&lsaquo;</a>
<a href="" title="Next page"  ng-class="{ disabled : pagination.current == pagination.last }" ng-click="setCurrent(pagination.current + 1)">&rsaquo;</a>

check out the link for more details. 请查看链接以获取更多详细信息。 https://github.com/michaelbromley/angularUtils/tree/master/src/directives/pagination#writing-a-custom-pagination-controls-template https://github.com/michaelbromley/angularUtils/tree/master/src/directives/pagination#writing-a-custom-pagination-controls-template

Go to dirPagination.tpl.html and delete this line: 转到dirPagination.tpl.html并删除以下行:

<li ng-repeat="pageNumber in pages track by tracker(pageNumber, $index)" ng-class="{ active : pagination.current == pageNumber, disabled : pageNumber == '...' }">
    <a href="" ng-click="setCurrent(pageNumber)">{{ pageNumber }}</a>
</li>

Doing that you will now only see the arrows. 这样一来,您现在只会看到箭头。

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

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