4
我有一個骨幹視圖和一個子視圖,每個都有自己的模板。我想追加子視圖,但在當前視圖內的特定div中。將子模板附加到當前模板中的特定div:Backbone
這是我的觀點和子視圖模板:
<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>
我想做的事,當我追加photoTmpl到containertmpl是,我想將其追加內部容器內。目前在骨幹視圖中,當我說
this.$el.append(view.render().el);
它清空容器div的內容並用photoTmpl div替換它。