バックボーン ビューの初期化中に次のエラーが発生します。
this.collection.on is not a function
私は次のビューを持っています:
define([
'jquery',
'underscore',
'backbone',
'events',
'utils',
'text!../../templates/vehicles-template.html'
],
function (
$,
_,
Backbone,
vent,
utils,
vehiclesTemplate) {
var VehiclesView = Backbone.View.extend({
template: vehiclesTemplate,
initialize: function () {
this.collection.on('reset', this.render, this); //error: this.collection.on is not a function
utils.log('Vehicles view initialized');
},
render: function() {
this.$el.empty().html(this.template({ vehicles: this.collection.toJSON() }));
return this;
}
});
return VehiclesView;
});
これはビューを返しますが、イベントにバインドしようとしてもコレクションまたはモデルで失敗しません。
ここで何が欠けていますか?