Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Add `{{#collection}}` specific behavior to `{{#each}}` #729

wagenet opened this Issue Apr 23, 2012 · 6 comments


None yet
5 participants

wagenet commented Apr 23, 2012

We've talked about deprecating {{#collection}}, however it still has some features that are missing from {{#each}}. We should finish moving these features over to {{#each}} so that we can deprecate {{#collection}}.

One of the most obvious cases is: <ul>{{#each}}<li>{{view MyView}}</li>{{/each}}</ul> vs {{collection tagName="ul" itemViewClass="MyView"}}. While the former is more clear, it also renders an extra view for every item, since you get both the view from the {{#each}} item and MyView. The latter only renders one MyView per item, which is definitely preferable. A possible solution for this is to allow {{#each}} to take an itemViewClass.


joliss commented Jun 3, 2012

(Deleted my previous comment -- {{#collection}} does exactly what I want. I should read the documentation more carefully.)


trek commented Jun 3, 2012

Happens to me all the damn time. It's extra embarrassing when you also wrote the documentation you didn't read.

If you don't deprecate collection, then please fix the context of the itemViewClass templates to be the itemViewClass, not the controller. Took me a while before i noticed i had to do {{view.title}} instead of {{title}}.


txominpelu commented Aug 19, 2012

@wagenet Is there still interest in fixing in this?

If so I've come up with a patch for it:



wagenet commented Aug 22, 2012

@txominpelu Yes, I think we'd still like to do this. Can you send a PR?


wagenet commented Oct 18, 2012

Should be resolved well enough by #1310.

@wagenet wagenet closed this Oct 18, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment