6

It seems that the @index variable of Handlebars’ {{#each}} helper isn’t yet implemented in Ember.Handlebars. Does anyone know when it will be available in Ember and what is the best solution to use until then?

Thank you very much in advance! Regards,

David

davidg
  • 651
  • 1
  • 7
  • 18
  • Refer this, It may related to yours [Refer this][1] [1]: http://stackoverflow.com/questions/8870785/positional-index-in-ember-js-collections-iteration – NkS Apr 22 '13 at 14:29
  • Thank you for your response! I’ve read this post but creating nested views for each item in the collection seems very heavy compared to how it could be done using this `@index` variable. I also read that some advise to create a counter as a computed property of the model but that doesn’t seem very clean either. That’s why I was wondering if anyone knew when this feature will be available for Ember or if a more elegant solution had been found in the meantime. Thank you again! Best regards, David – davidg Apr 22 '13 at 15:25

1 Answers1

1

This works for me (within my child template):

<div {{bindAttr index="view._parentView.contentIndex"}}>
</div>
chopper
  • 6,649
  • 7
  • 36
  • 53