Reputation: 3400
My model:
var ListModel = Backbone.Model.extend({
defaults:{
title: "",
items:new Array(),
},
initialize: function(){
}
...
but for some reason when i do:
function createNew(){
var m = new ListModel();
console.log(m);
[model items get modified somehow]
}
createNew()
createNew()
the output for the model.items are identical between the two models
Why is that?
Upvotes: 0
Views: 110
Reputation: 3400
It appears that I need to do:
initialize: function(){
this.set("items", new Array());
}
instead of doing it in default
Upvotes: 1