handlebars-paginate

Handlebars helper for pagination.

npm install handlebars-paginate
1 downloads in the last day
20 downloads in the last week
68 downloads in the last month

Handlerbars Paginate helper

screenshot

Install

npm install handlebars-paginate

Usage

hbs.js

/* ... */

var paginate = require('handlebars-paginate');

Handlebars.registerHelper('paginate', paginate);

/* ... */

var html = template({pagination: {
  page: 3,
  pageCount: 10
}});

template.hbs

<div class="pagination pagination-centered">
  <ul>
    {{#paginate pagination type="previous"}}
      <li {{#if disabled}}class="disabled"{{/if}}><a href="?p={{n}}" >Prev</a></li>
    {{/paginate}}
    {{#paginate pagination type="middle" limit="7"}}
      <li {{#if active}}class="active"{{/if}}><a href="?p={{n}}">{{n}}</a></li>
    {{/paginate}}
    {{#paginate pagination type="next"}}
      <li {{#if disabled}}class="disabled"{{/if}}><a href="?p={{n}}">Next</a></li>
    {{/paginate}}
  </ul>
</div>
npm loves you