I've recently started using Marionette and I'm looking to create a CollectionView within another CollectionView. I came across information stating that when a view receives a collection as an argument, it is stored as 'items' argument. My issue can be summed up as follows:
const { View, CollectionView } = Marionette;
const collection = new Backbone.Collection([
{name: 'Marionette.js'}, {name: 'Backbone.js'}
]);
const MyView = View.extend({
el: 'body',
template: _.template(`
<ul>
<% _.each(items, function(item) { %>
<li><%- item.name %></li>
<% }) %>
</ul>
`)
});
const MyCollectionView = CollectionView.extend({
childView: MyView
})
const myCollectionView = new MyCollectionView([{collection: collection}]);
myCollectionView.render();
However, I'm facing difficulties with this code. Any assistance would be greatly appreciated.