var ItemView = Backbone.View.extend({
tagName:"li",
className:"l-item",
template:_.template("#tpl-list-item"),
.....
});
var ListView = Backbone.View.extend({
render:(){
this.collection.each(function(model){
this.$el.append(new ItemView({model:model}).render().$el);
});
}
});
<script id="tpl-list-item" type="text/template">
<div>
// other markup
<div>
</script>
As shown once I want to update the representation of the itemview, I will have to check both the js and the template file.
And I prefer to build the view from the template only to avoid set the representation in the code like :
<script id="tpl-list-item" type="text/template">
<li class="....">
<div>
// other markup
<div>
</li>
</script>
Is this possible?