Coder Social home page Coder Social logo

angularjs-ui's Introduction

AngularJs Pagination -- Want to be the best Pagination

Since name for a pagination is boring, so I decide name it to tm.I'm not good at English, wish you you catch what I said And help me improve my English.

tm.pagination -- A very simple and useful pagination in AngularJs

Online demo tm.pagination

relate blog articles:

default:

with some css and template change you can turn it to this

// in the view
<tm-pagination conf="paginationConf"></tm-pagination>

// in the controller
$scope.paginationConf = {
    currentPage: 1,
    totalItems: 8000,
    itemsPerPage: 15,
    pagesLength: 15,
    perPageOptions: [10, 20, 30, 40, 50],
    onChange: function(){

    }
};

conf is a object, it has attributes like below:

  • currentPage: Current page number, default 1
  • totalItems: Total number of items in all pages
  • itemsPerPage: number of items per page, default 15
  • onChange: when the pagination is change, it will excute the function
  • pagesLength: number for pagination size, default 9
  • perPageOptions: define select how many items in a page, default [10, 15, 20, 30, 50]

if you want to use with ajax,you may follow like this:

$scope.paginationConf = {
    onChange: function() {
        $http.get('xxx', function(data) {
            $scope.paginationConf.totalItems = data.totalItems;
        })
    }
};

angularjs-ui's People

Contributors

miaoyaoyao avatar wlykan avatar

Watchers

 avatar  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.