Giter Club home page Giter Club logo

bb-paginate's Introduction

For Standard Pagination:

<div bb-paginate="paginationData"
on-page-select="myFunctionOnScope(pageNumber)" />

Where paginationData MUST have attributes:

  • current_page
  • total_entries
  • per_page

Customizing:

Custom Paginator

Supply your own Paginator. This should subclass Paginator.

StandardPaginator, already a descendent of Paginator, can probably be easily overriden for most use cases.

Example:

Say you don't want to show prev/next arrows, and the initial number of pages ('left' window) should be 10 instead of 5):

app.factory 'MyCustomPaginator', ['StandardPaginator', (StandardPaginator) ->
  class MyCustomPaginator extends StandardPaginator
    constructor: (args...) ->
      super
      @windowSize.left = 10

    showNextPage: => false
    showPrevPage: => false
]
<div bb-paginate="paginationData" paginator="MyCustomPaginator" />

Controller API

BbPaginate also features a controller that can be leveraged by other components that wish to extend or hook into the basic functionality.

onPageSelect()

app.directive 'paginateBeacon', ($http) ->
  require: 'bbPaginate'
  link: ($scope, $element, $attrs, bbPaginateCtrl) ->
    bbPaginateCtrl.onPageSelect (pageNum) ->
      $http.get("/page_changed?page=#{pageNum}")
<div bb-paginate="paginationData" paginate-beacon />

bb-paginate's People

Contributors

wadetandy avatar

Watchers

Chaz Chandler 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.