私は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();
私の見解の1つでは、コレクションに次のような新しいモデルを作成しようとしています。
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());
それはすべてどこからともなく突然起こり始めました。それは数分前に働いていました。私はそれがlocalstorageと何かをしなければならないと思います。私はそれをクリアしましたが、それでも同じです。Firefoxコンソールでd.collectionが未定義であると表示されます。
ご案内ください。