Skip to content

Instantly share code, notes, and snippets.

@atleastimtrying
Created September 2, 2014 14:59
Show Gist options
  • Save atleastimtrying/40e1367e870b2eeb85c3 to your computer and use it in GitHub Desktop.
Save atleastimtrying/40e1367e870b2eeb85c3 to your computer and use it in GitHub Desktop.
sample of adding indexs to a mustache template
var hints = [ 'hint1', 'hint two', 'hint three', 'hint 4' ];
var hints_with_ids = hints.map(function(hint, index){
return { name: 'hint' + index, hint: hint } ;
});
<ul>
{{#hints}}
<li data-id="{{id}}">{{hint}}</li>
{{/hints}}
</ul>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment