I'm having trouble rendering a Marionette LayoutView and showing a region inside that layout.
My layout file:
template: '#fooTemplate',
regions: {
barRegion: '.bar'
}
My HTML:
<script id="fooTemplate" type="text/template">
<div id="fooDiv">
<div class="bar">
</div>
</div>
</script>
The code that renders the layout and shows the region:
var FooLayout = require('./browserify/path');
var fooLayout = new FooLayout({el:"#fooDiv"})
collectionView = new CollectionView({
collection: collection
});
fooLayout.render();
fooLayout.barRegion.show(collectionView);
I get an error Uncaught Error: An "el" #foo .bar must exist in DOM
What am I missing in LayoutView's functionality? I have a similar example working just fine, but for some reason I cannot replicate it.