Difference between Ember.CollectionView and Ember.ContainerView

I read the comments on the source code and emberjs api , but I really don't feel like I got a very clear idea of ​​the differences between the two types of Ember.View. If someone can identify situations where you can use Ember.ContainerView rather than Ember.CollectionView, and vice versa, I would be very grateful. Thanks!

+4
source share
1 answer

CollectionView = same child view over and over

This is useful if you want to have a view object for each element of the array. For example, if there is a list of messages and you want to show a PostSummary view for each of them. A typical ember application will do this using the {{each}} handlebars helper, which was implemented using CollectionView.

ContainerView = different child views

Ember.ContainerView when you need to programmatically manage an arbitrary list of children. CollectionView extends ContainerView. Alternatively, you can use helper assistants to insert child templates using the legend around {{view}} helpers.

+5
source

All Articles