In Ember.js, what's the difference between using {{#collection}} and {{#each}}? In which cases would you use which?
Hum, well... quite a good question... as you can see here : #729, it seems that the {{collection}} helper is going to be deprecated in favor of using always {{#each}}. But at this time, all features available in {{#collection}} are not in {{#each}}.
So, I would recommend you to use {{#each}} when it works for you, and only use {{collection}} when absolutely needed. (when you need to define itemViewClass for example).
Update: since 1.0.0-pre.2, the itemViewClass attribute to the each helper. The only remaining thing the collection helper has over the each one, is you can explicitely define the collection class to use if you have extended Ember.CollectionView.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With