我将 Tastypie 用于我的 RESTful api 和 Backbonejs 用于前端。with 模型工作正常,fetch
但是,Backbone.Collection
我似乎得到了错误的响应:
_byCid: Object
_byId: Object
_callbacks: Object
_onModelEvent: function () { [native code] }
_removeReference: function () { [native code] }
length: 1
models: Array[1]
0: d
_callbacks: Object
_changed: false
_changing: false
_escapedAttributes: Object
_previousAttributes: Object
attributes: Object
cid: "c14"
collection: d
__proto__: o
length: 1
__proto__: Array[0]
__proto__: o
这是我的收藏:
define(
[
'models/ad',
],
function(AdModel){
return Backbone.Collection.extend({
url: '/api/v1/ad',
model: AdModel,
initialize: function(){
this.fetch({
success: function(coll, resp){
console.log(coll);
}
});
}
});
}
);
这是我的模型:
define(
[],
function(){
return Backbone.Model.extend({
});
}
);