Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ember.js: How to get the index value while looping over items of a collection using the {{#each}} helper?

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

like image 585
davidg Avatar asked Apr 22 '13 13:04

davidg


1 Answers

This works for me (within my child template):

<div {{bindAttr index="view._parentView.contentIndex"}}>
</div>
like image 103
chopper Avatar answered Oct 21 '22 07:10

chopper