Search code examples
javascriptbackbone.jshandlebars.jsthorax.js

Thorax collection of views


I have a collection where each element of the collection is a view. I want to display all of the views one right after the other. How can I do this? The following doesn't work:

    {{#collection logicViews item-view="LogicView"}}
    {{view this}}
    {{/collection}}

Solution

  • I think that an array of views would work for you here, for 2 reasons. #1, collections/models are supposed to represent business logic/CRUD resources. #2 (and this gets at your issue), the collection helper wraps your view within a view already, and probably adds a layer or two of complication that you probably don't need. I'd see if you can get away with putting your views in an array, and using an {{each}} loop to display them.

    edit: here's an example fiddle, http://jsfiddle.net/carpeliam/bv2f1yya/.