Tuesday, August 19, 2014

AngularJS: paging

There should be better way to do the paging for AngularJS. However this is my version of paging, and it works.
<div id='xxxPaging' ng-show="getPageTotal().length > 1">
     <span ng-class="{spanLink:!hover,spanLinkhover:hover}" ng-mouseover="hover=true" ng-mouseleave="hover = false" ng-click="searchCall('paging',current-1);"  ng-show="1!=current && getPageTotal().length>3"><</span>
       <span ng-repeat="i in getPageTotal() track by $index">

         <b ng-show="i==current" class="spanNoLink">{{i}}</b>     

         <span ng-class="{spanLink:!hover,spanLinkhover:hover}" ng-mouseover="hover=true" ng-mouseleave="hover = false" ng-click="searchCall('paging',i);"  ng-show="i!=current && (i-1 == current || i - 2 == current || i + 1  == current || i + 2 == current || i == 1 || i == getPageTotal().length)">{{i}}</span>

         <span class="spanNoLink" ng-show="i != current && i < getPageTotal().length && (i+ 3 == current || i- 3 == current ) && i+3 != 4">..</span>

      </span>
      <span ng-class="{spanLink:!hover__,spanLinkhover:hover__}" ng-mouseover="hover__=true" ng-mouseleave="hover__ = false" ng-click="searchCall('paging',current+1);"  ng-show="getPageTotal().length!=current && getPageTotal().length>3">></span>
</div>

No comments:

Post a Comment