バックボーンとバックボーン レイアウト マネージャーは初めてです。連絡先のリストをレンダリングしようとしています。ここにコードのスニペットがあります
var ContactListView = Backbone.Layout.extend({
tagName: 'li',
initialize: function (){
console.log('ContactListView init');
this.render();
},
render: function (){
console.log('Rendering all items in the contact list');
_(this.collection.models).each(function (contact){
var contactlistitem = new ContactListItemView({model: contact});
self.$el.append(contactlistitem.el);
});
}
});
var ContactListItemView = Backbone.Layout.extend({
initialize: function (){
this.render();
},
render: function (){
console.log('called');
var template = Handlebars.compile($('#contact-list-item').html());
this.el.html(template(this.model));
}
});
ページに移動すると、コンソールは「ContactListView init」をログに記録しますが、「連絡先リストのすべてのアイテムをレンダリングしています」を出力しません。どうしてこれなの?