Adding an additional template to a separate div inside the current template: Backbone

I have a base view and a subview, each with its own template. I want to add a subview, but in a specific div inside the current view.

These are my view and subtitle templates:

<script type="text/template" id="containerTmpl"> <div id="container"> <div id="inner-container"> </div> </div> </script> <script type="text/template" id="photoTmpl"> <img src="<?- url ?>" alt="" /> </script> 

What I want to do, when I add photoTmpl to includeertmpl, I want to add it inside the inner container. Currently in spine mode when i say

 this.$el.append(view.render().el); 

It empties the contents of the div container and replaces it with a divText.

+4
source share
1 answer

Get the inner container from this element and draw a subview in it:

 this.$('#inner-container').append(view.render().el); 
+4
source

All Articles