Instead of accessing models
collection directly from within views, use get()
, at()
or underscore functions.
The following patterns are considered warnings:
Backbone.View.extend({
render: function() {
alert(this.model.models.length);
}
})
The following patterns are not warnings:
Backbone.View.extend({
render: function() {
alert(this.collection.at(0));
}
});