0

I use meteor 1.2

Here is my code :

{{#each steps}}
{{#each buttons}}
<button class="car-action-button" data-step-index="{{../@index}}" data-button-index="{{@index}}" data="{{../idOnMap}}" data-cid="{{../../cid}}">
</button>
{{/each}}
{{/each}}

{{../@index}} should return the steps rank but doesn't return anything. Is ther a way to do that ?

pneumatics
  • 2,836
  • 1
  • 27
  • 27
tedour
  • 63
  • 5
  • You don't need coffeescript sugar (@), do you have index in object over which you are iterating? Because Meteor doesn't provide that value – sdooo Sep 28 '15 at 10:47
  • It's a new functionnality of meteor : http://stackoverflow.com/questions/21815713/in-meteor-is-there-a-way-to-access-array-index-in-spacebars – tedour Sep 28 '15 at 11:19

1 Answers1

3

Ok, here is my solution :

{{#each steps}}
{{#let index = @index}}
{{#each buttons}}
<button class="car-action-button" data-step-index="{{index}}" data-button-index="{{@index}}" data="{{../idOnMap}}" data-cid="{{../../cid}}">
</button>
{{/each}}
{{/let}}
{{/each}}

Hope it help someone :)

tedour
  • 63
  • 5