我有这个小提琴:http://jsfiddle.net/tbuchanan/eqtxLkbg/4/
我有我需要的功能,除了我需要在循环浏览页面时向当前页面添加活动类:
<ul class="pagination-controle pagination">
<li>
<button type="button" class="btn btn-default" ng-hide="curPage == 0"
ng-click="curPage = curPage-1"> < PREV</button>
</li>
<li>
<span ng-click="curPage = curPage - 2" ng-hide="curPage < datalists.length/pageSize - 1">{{curPage - 1}}</span>
<span ng-click="curPage = curPage - 1" ng-hide="curPage === 0">{{curPage}}</span>
<span>{{curPage + 1}}</span>
<span ng-click="curPage = curPage + 1" ng-hide="curPage >= datalists.length/pageSize - 1">{{curPage + 2}}</span>
<span ng-click="curPage = curPage + 2" ng-hide="curPage >= datalists.length/pageSize - 2">{{curPage + 3}}</span>
<span ng-click="curPage = curPage + 3" ng-hide="curPage !== 0 ">{{curPage + 4}}</span>
</li>
<li>
<button type="button" class="btn btn-default"
ng-hide="curPage >= datalists.length/pageSize - 1"
ng-click="curPage = curPage+1">NEXT ></button>
</li>
</ul>
任何人都可以帮助我实现这个目标吗?
答案 0 :(得分:0)
事实证明,根据现有逻辑,第一个可见范围始终是当前页面。所以我可以随时在该元素上应用一个活动类。更新了小提琴:http://jsfiddle.net/tbuchanan/eqtxLkbg/5/
<span class="active pagination-button">{{curPage + 1}}</span>