我在backbonejs应用程序中有以下内容:
////MODEL
var app={};
app.ledger=Backbone.Model.extend();
////COLLECTION
app.ledgerList=Backbone.Collection.extend({
model: app.ledger,
localStorage:new Store('ledgerstore')
});
////INITIATING COLLECTION
app.ledgerlist=new app.ledgerList();
在我的一个观点中,我尝试在集合中创建一个新模型,如下所示:
newAttributes:function(){
return{
name:$("#ledgerName").val(),
email: $("#ledgerEmail").val(),
address: $("#ledgerAddress").val(),
phone: $("#ledgerPhone").val()
}},
saveLedger: function(){
app.ledgerlist.create(this.newAttributes());
}
我收到错误Uncaught TypeError: Cannot read property 'localStorage' of undefined
在线上app.ledgerlist.create(this.newAttributes());
这一切都是突然突然发生的。几分钟前它还在工作。我想它必须与本地存储做一些事情。我清除了但还是一样。在 Firefox 控制台中显示 d.collection 未定义。
请指导。
None
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)