AngularJS pagination – AngularJS pagination example

AngularJS pagination – AngularJS pagination example

AngularJS pagination – AngularJS pagination example is an example of how to implement pagination with AngularJS or javascript with logic like google search engine results.

The case is composed in AngularJS, however the pagination rationale is unadulterated javascript so it could without much of a stretch be utilized with other javascript apparatuses and structures, for example, NodeJS, ReactJS, EmberJS and so on.

View DemoDownload

The front end pagination segment in the illustration is styled utilizing Bootstrap.

In following up code we create index.html and script.js for AngularJS pagination example, we pass value uisng for loop and pass value in pagination. youy need to chage this valu with your value. pass you value to index.html. it is very easy and simple method for AngularJS pagination example.

index.html for AngularJS pagination example

<!DOCTYPE html>
<html ng-app="pagination">

    <link rel="stylesheet" href="#" />
    <script src=""></script>
    <script src=""></script>
    <script src=""></script> 
	<title>AngularJS pagination - AngularJS pagination with example </title>

  <body ng-controller="TodoController">
    <h1>AngularJS pagination - AngularJS pagination with example </h1>
	<h2>AngularJS pagination with example</h2>
    <h4>{{pagination.length}} remain</h4>
      <li ng-repeat="paging in filteredTodos">{{paging.text}}</li>
    <div data-pagination="" data-num-pages="numPages()" 
      data-current-page="currentPage" data-max-size="maxSize"  


script.js for AngularJS pagination example

var pagination = angular.module('pagination', ['ui.bootstrap']);

pagination.controller('paginationController', function($scope) {
   $scope.filteredpagination = []
  ,$scope.currentPage = 1
  ,$scope.numPerPage = 10
  ,$scope.maxSize = 5;
  $scope.makepagination = function() {
    $scope.pagination = [];
    for (i=1;i<=1000;i++) {
      $scope.pagination.push({ text:'paging  '+i, done:false});
  $scope.numPages = function () {
    return Math.ceil($scope.pagination.length / $scope.numPerPage);
  $scope.$watch('currentPage + numPerPage', function() {
    var beginPage = (($scope.currentPage - 1) * $scope.numPerPage)
    , end = beginPage + $scope.numPerPage;
    $scope.filteredpagination = $scope.pagination.slice(beginPage, end);

See hear ::

View DemoDownload

Exit mobile version