0
總之一個複雜的集合我要讓其他收藏品和模型創建backbonejs
的結構是這樣的
[{
mainCategory: "Something"
subCategories: [
{
category: "SomethgingElse",
labs: [
{
id: 1,
title: "Title",
description : "Lorem ipsum dolor sit amet"
availablelanguages: ["fr","en"]
},
{
id: 2,
title: "Another Title",
description : "Lorem ipsum dolor sit amet",
availablelanguages: ["fr","en"]
}]
},
{
category: "Testing",
labs: [
{
id: 1,
title: "ZZZZ",
description : "Lorem ipsum dolor sit amet"
availablelanguages: ["ar","en"]
},
{
id: 2,
title: "VVVVV",
description : "Lorem ipsum dolor sit amet",
availablelanguages: ["ar","en"]
}]
}
]
}]
我定義的一些收藏品和模型,如以下
的骨幹深具珍藏var Item = Backbone.Model.extend({
defaults: {
title : '',
description: '',
availableLangagues : []
}
});
var Items = Backbone.Collection.extend({
model: Item
});
var Category = Backbone.Model.extend({
defaults: {
categoryName: '',
labsList: new Items()
}
});
var Categories = Backbone.Collection.extend({
model: Category
});
var TopCategory = Backbone.Model.extend({
defaults: {
topCategory: "",
categories: new Categories()
}
});
var TopCategories = Backbone.Collection.extend({
model: TopCategory
});
我的問題在這裏我要呼籲TopicCategories
我想填充一切fetch
,將fetch
無線會返回一個JSON
比如上例中通過,但如果我上TopCategories
叫fetch
它會返回數據,但就像我在默認