Rajeev Rajeev - 3 months ago 11
AngularJS Question

add text instead of numbers in pagination, angular-bootstrap

I am using angular-bootstrap for pagination and want to change page number with text like year(eg. 2015, 2014, 2013).
Can we customize angular pagination directive so that achieve that case?

Answer

Write your own directive on base of the 'pagination' directive and just modify the getPages function. plnkr

    // Add page number links
    for (var number = startPage; number <= endPage; number++) {
      var text = parseInt(scope.startYear, 10) + (number - 1);
      var page = makePage(number, text, number === currentPage);
      pages.push(page);
    }
Comments