Skip to content

alphonse92/mv.paginator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 

Repository files navigation

mv.paginator

Angular plugin for easy paginate any element.

DEMO using www.jsonplaceholder.com requests: https://jsfiddle.net/alphonse92/x528jk9f/

##Instalation:

Using NPM:

  npm install mv-paginator

###Using BOWER:

  bower install mv-paginator

##HTML impl

The innerHTML especifies the template, basically the plugin add a ng-repeat to the first element. $paginator_item is the item's array, and name is the property for this object.

  <paginator pagedata="pagedata">
       <div>{{$paginator_item.name}}</div>
  </paginator>

##config

.config(['paginatorProvider',function(paginatorProvider){
                paginatorProvider.setConfig({
                    lengthDefault:5, /* five elements per page*/
                    labelBefore:"<",
                    labelNext:">",
                    labelFirst:"<<",
                    labelLast:">>"
                })
        }])

##Controller

angular.module('app', ['com.alphonsegs.paginator'])
        .config(['paginatorProvider',function(paginatorProvider){
                paginatorProvider.setConfig({
                    lengthDefault:5,
                    labelBefore:"<",
                    labelNext:">",
                    labelFirst:"<<",
                    labelLast:">>"
                })
        }])
        .controller("mainController", function ($scope) {
            $scope.pagedata = [];
            $scope.loadata = function () {

                for (var i = 0; i < 500; i++)
                {
                    $scope.pagedata.push({name: "alejandro-" + i})
                }
            }
            $scope.loadata();
        })

Preview

alt tag

About

Angular plugin for easy paginate elements.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published