I'm new to Backbone.js.I have tried to create collection in Backbone while creating that i'm getting error as ' d.collection is undefined error'.
$(function(){
var MyModel = Backbone.Model.extend();
var MyCollection = Backbone.Collection.extend({
url: '/index.html',
model: MyModel
});
var coll = new MyCollection();
coll.fetch({
error: function (collection, response) {
console.log('error', response);
},
success: function (collection, response) {
console.log('success', response);
}
});
});
Also i need to handle the express route method result in Backbone.How can i handle that..
app.js
app.all('*',function(req,res){
var result={a:'a',b:'b',c:'c'};
res.writeHead(200, {'Content-Type': 'text/json'});
res.write(JSON.stringify(result));
res.end();
});
I had this error, and found that it goes away when you remove backbone.localStorage-min.js from your head includes.