Skip to content

dsuket/handlebars-helpers

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 

Repository files navigation

What's this ?

helper functions for handlebars JavaScript template engine.

Helpers

each_with_idx

each function with loop index.

Usage:

    <ul class="people_list">
      {{#each_with_idx people}}
      <li>{{this.idx}} - {{this}}</li>
      {{/each}}
    </ul>

Result:

    <ul class="people_list">
      <li>0 - Yehuda Katz</li>
      <li>1 - Alan Johnson</li>
      <li>2 - Charles Jolley</li>
    </ul>

Options:

  • start
  • number of start index.

Example

    <ul class="people_list">
      {{#each_with_idx people start=5}}
      <li>{{this.idx}} - {{this}}</li>
      {{/each}}
    </ul>

Result:

    <ul class="people_list">
      <li>5 - Yehuda Katz</li>
      <li>6 - Alan Johnson</li>
      <li>7 - Charles Jolley</li>
    </ul>

See

License

Copyright (c) 2012 Daisuke Takaoka. MIT License.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published