我尝试获取一个简单的Backbone Collection,但是我收到以下错误。
必须指定“url”属性或函数
var Collection = Backbone.Collection.extend({url: '/path/toCollection'});
var collection = new Collection([]);
app.vent.bindTo('applicationDidBecomeActive', collection.fetch);
app.vent.trigger('applicationDidBecomeActive');
//Error: A "url" property or function must be specified
答案 0 :(得分:1)
您是否需要绑定'this'参数?
app.vent.bindTo('applicationDidBecomeActive', collection.fetch, collection);