nicholaides
nicholaides

Reputation: 19489

Ember.js: difference between {{#collection}} and {{#each}}?

In Ember.js, what's the difference between using {{#collection}} and {{#each}}? In which cases would you use which?

Upvotes: 3

Views: 192

Answers (1)

sly7_7
sly7_7

Reputation: 12011

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.

Upvotes: 5

Related Questions