lundi 27 juillet 2015

Getting index counter in nested loop of embers handlebar

I followed http://ift.tt/1JJIfc5 blog post to add index counter through helper. This works perfectly fine with single each loop. But when i use it with nested each loop the value gets repeated. Example :

{{#each item in data}} {{#eachIndexed record in item.innerdata}} {{index_1}} {{/eachIndexed}} {{/each}}

I have two objects in data and two objects in each innerdata. Expected result is

1 2 3 4

but I'm getting

1 2 1 2

How do i get the expected result? My handlebars version is 1.1.2 and ember version is 1.6.1.




Aucun commentaire:

Enregistrer un commentaire