Giter Club home page Giter Club logo

angular-ui-pagination's Introduction

angular-ui-pagination

angular-ui-pagination 分页 / AngularJS 分页 / pagination

Supported by all modern browsers: Chrome, Firefox, Opera, Safari, IE8+

YoomJS

Installation

Download the package from github. The package is also availble over npm install angular-ui-pagination or bower install angular-ui-pagination

Include 'javascript' and 'css' files into your page.

Declare a dependency on the module.

angular.module('myModule',['angular-ui-pagination']);

Insert the pagination in your html template Default pagination

<div class="row">
	<div class="col-12">
		<ui uipagination total-items="totalItems" ng-model="currentPage" class="pagination" ng-change="pageChanged()"></ui>
	</div>
</div>

Design

You can completely change the design if you want.
.pagination {
    margin-top: 0;
}
.pagination .page-item .page-link {
    color: #37a884;
}
.pagination .page-item.active .page-link,
.pagination .page-item.active .page-link:focus,
.pagination .page-item.active .page-link:hover {
    color: #fff;
    border-color: #37a884;
    background-color: #37a884;
}
.pagination > .active > a, .pagination > .active > span, .pagination > .active > a:hover, .pagination > .active > span:hover, .pagination > .active > a:focus, .pagination > .active > span:focus {
    border-color: #37a884 !important;
    background-color: #37a884 !important;
}

How to Use

var ngApp = angular.module('app', ['angular-ui-pagination']);
PaginationCtrl.$inject = ['$scope','$http'];
function PaginationCtrl($scope, $http) {
    $scope.viewModel = {
        totalItems:40,      // 总记录数
        currentPage: 1,     // 当前页(默认第一页)
        tableData: {}
    };

    $scope.pageChanged = function () {
        query($scope.viewModel.currentPage);
    };

    // 初始化
    $scope.init = function () {
        query($scope.viewModel.currentPage);
    }

    // 查询
    var query = function (currentPage) {
        var  request = {
            method: 'POST',
            url: 'xxx',
            data: { pageNo: currentPage, pageSize: 10 }
        };

        $http(request)
        .then(function (response) {
               // $scope.viewModel.totalItems = response.data.rowCount;
                $scope.viewModel.tableData = response.data;
                console.log(response.data);
         });
    }
}
ngApp.controller("PaginationCtrl", PaginationCtrl);

angular-ui-pagination's People

Contributors

xiangxiong avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.