在我的应用程序中,我从 baseCollection 保留了一个 baseCollection,我正在扩展更多集合以获取数据。但我收到一条错误消息:
Uncaught TypeError: Object [object Object] has no method 'extend'
是什么原因..?
这是我的基本收藏:
define(["backbone","models/model"], function (Backbone,model) {
var baseCollection = Backbone.Collection.extend({
//this is the base url
url:"https://recordsmanager.mahindrasatyam.com/EDMSWSStatic/rest/",
model:model,
initialize:function(){
console.log("base collection initialized");
}
});
return new baseCollection;
})
我的导航集合:(扩展基本集合):
define(["backbone","models/model","collection/baseCollection"], function (Backbone,model,baseCollection) {
var headerCollection = baseCollection.extend({
//i am getting navigation Json my url should be (https://recordsmanager.mahindrasatyam.com/EDMSWSStatic/rest/edms/navigationLinks)
url:"edms/navigationLinks",
model:model,
initialize:function(){
console.log(baseCollection);
},
parse:function(response){
console.log(response);
}
});
new headerCollection;
})
但我无法扩展基本集合。我的做法是错的吗..?如果是这样,扩展基本 URL 的正确方法是什么(我确实没有视图,所以我没有集合需要从基本 URL 扩展)。
提前致谢。