In Handlebars, say i have a collection of names
how can i do
{{#each names}}
{{position}}
{{name}}
{{/each}}
where {{position}} is
You can do this with the built-in Handlebars @index notation:
{{#each array}}
{{@index}}: {{this}}
{{/each}}
@index will give the (zero-based) index of each item in the given array.
Please note for people using Handlebars with the Razor view engine you must use the notation @@index to avoid compilation errors.
For more built-in helpers see http://handlebarsjs.com/