Created
September 2, 2014 14:59
-
-
Save atleastimtrying/40e1367e870b2eeb85c3 to your computer and use it in GitHub Desktop.
sample of adding indexs to a mustache template
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var hints = [ 'hint1', 'hint two', 'hint three', 'hint 4' ]; | |
var hints_with_ids = hints.map(function(hint, index){ | |
return { name: 'hint' + index, hint: hint } ; | |
}); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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