Open In App

How to make Pager using Angular UI bootstrap ?

Last Updated : 19 Jul, 2021
Improve
Improve
Like Article
Like
Save
Share
Report

In this article, we will see how to make Dropdown using Angular UI bootstrap. It is an AngularJS framework created by Angular UI developers for providing better UI which can be used easily.

Syntax:

<div uib-pager></div>

Download AngularUI from the link:

https://angular-ui.github.io/bootstrap

Approach:

  • First, add Angular UI bootstrap scripts needed for your project.

<script src=”https://ajax.googleapis.com/ajax/libs/angularjs/1.6.1/angular.js”></script>
<script src=”https://ajax.googleapis.com/ajax/libs/angularjs/1.6.1/angular-animate.js”></script>
<script src=”https://ajax.googleapis.com/ajax/libs/angularjs/1.6.1/angular-sanitize.js”></script>
<script src=”https://angular-ui.github.io/bootstrap/ui-bootstrap-tpls-2.5.0.js”></script>

  • Make pager with its UIBootStrap classes which will set the UI look for the pager.
  • Now make different types of pager using different classes and run the code.

Example:




<!DOCTYPE html>
<html ng-app="gfg">
  
<head>
  
    <!-- Adding CDN scripts required for our page -->
    <script src=
    </script>
    <script src=
    </script>
    <script src=
    </script>
    <script src=
    </script>
  
    <script>
  
        // Adding Modules
        angular.module('gfg', ['ngAnimate'
            'ngSanitize', 'ui.bootstrap']);
  
        angular.module('gfg').controller('pager'
            function ($scope) {
                $scope.page = 10
            });
    </script>
  
    <link href=
        rel="stylesheet">
</head>
  
<body>
    <div ng-controller="pager">
  
        <!-- Making a pager -->
        <h4>GeeksforGeeks Pager</h4>
        <pre>This is {{page}}th page</pre>
        <ul uib-pager total-items="100" 
            ng-model="page">
        </ul>
    </div>
</body>
  
</html>


Output:

Reference: https://angular-ui.github.io/bootstrap/#!#pager



Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads