I was messing around with the Meteor Leaderboard example. Say I wanted to display the index of an element inside a #each handlebars loop:
{{#each players}}
{{> player}}
{{/each}}
<template name="player">
<div class="player {{selected}}">
<span class="index">{{index}}</span>
<span class="name">{{name}}</span>
<span class="score">{{score}}</span>
</div>
</template>
Usually you need to write a helper for this, but it's hard for me to figure out how to make it work with the Meteor collection.
How to do it? Thank.
source
share