2
我已经在这里设立问题的jsBin:http://jsbin.com/oSIJunu/2/edit?html,js,console,outputBackbone.js的 - 集合视图使“类型错误:无法读取属性未定义的“厄尔尼诺”错误
集合视图不会因渲染到问题与渲染功能(friendView.render()。el)el属性)。
的看法是这样的:
var FriendListView = Backbone.View.extend({
render: function(){
this.collection.forEach(this.addOne, this);
},
addOne: function(friendModel){
var friendView = new FriendView({model: friendModel});
this.$el.append(friendView.render().el);
}
});
渲染方法不返回任何值 –
我不知道骨干......但也有一些是严重错误在这里......因为递归调用 –
您需要返回您FriendView对象'FriendView的.render()'允许可连续调用。 '回到这个;'应该这样做。 –