これは私のコレクションのビューです:
Network.Views.Offers.Index = Backbone.View.extend({
initialize: function() {
_.bindAll(this, 'render');
this.collection = new Network.Collections.Offers();
this.collection
.on('reset', this.render)
.fetch();
},
render: function() {
var self = this;
_.each(this.collection.models, function(model) {
var view = new Network.Views.Offers.Offer({ model: model });
$(self.el).append(view.el);
view.adjustHeight();
});
return this;
},
});
フェッチが成功した後、スピナークラスを追加および削除しようとしました:
this.$el.append('<div class="loading">Loading...</div>');
this.collection
.on('reset', this.render)
.fetch({
success:function() {
this.$el.removeClass('loading');
}
});
しかし、私は得る:
Uncaught TypeError: Cannot call method 'removeClass' of undefined