Given these templates:
<script id="template1" type="layout">
Template 1 contents
</script>
<script id="template2 type="layout">
Template 2 contents
<section class="subview"></section>
</script>
And this view setup:
var View1 = Backbone.LayoutView.extend({
template: "#template1"
});
var View2 = Backbone.LayoutView.extend({
template: "#template2",
views: {
".subview": new View1();
}
});
I get this output:
Template 2 contents
<section class="subview"><div>Template 1 contents</div></section>
How can I instead get this output?
Template 2 contents
<section class="subview">Template 1 contents</section>
If template1 had the contents:
then you may use jQuery's unwrap() to remove the element in backbone layout managers afterRender() function