mardi 14 avril 2015

Split and group a collection of items in Ember

I'm trying to take a collection of records in Ember and split them into groups of some number, say 2.


So for example, with something like



{{#each node in model}}
<span>node.name</span>
{{/each}}


I get <span>thing</span><span>other thing</span><span>some thing</span><span>one more thing</span>


I want to be able to pass node to something and wrap every 2 nodes with a div something like <div><span>thing</span><span>other thing</span></div><div><span>some thing</span><span>one more thing</span></div>


In Ember 2.0 where most everything should be a component, where is the best place to handle this logic. Should it be a component or controller?





Aucun commentaire:

Enregistrer un commentaire