vendredi 20 février 2015

Find last but one element in #each helper in ember

In my ember application I've a scenario where I want to display the last but one element of an array in a different way.



{{#each item in model}}
{{#if lastButOneItem}}
+ {{item}}
{{else}}
{{item}} +
{{/if}}
{{/each}}


But I'm not sure how to put the condition for the lastButOneItem. Is there a simple way to achieve it ?


I tried assigning an ItemController for this. But I can't get the total number of elements from that item controller and the current index.


Any help please.





Aucun commentaire:

Enregistrer un commentaire