Using backbone.js, here is a quick test to demonstrate the problem I am facing with nested models.
Preface I have a Obj Model that
With:
var Obj = Backbone.Model.extend({
defaults: {
obj1 : new Obj1(),
obj2 : new Obj2()
}
})
You are saying that you want all objects created with "Obj" to have the same "obj1" and "obj2" values, use:
var Obj = Backbone.Model.extend({
initialize: function() {
this.obj1 = new Obj1();
this.obj2 = new Obj2();
}
});
To achieve what you seen to want. http://documentcloud.github.com/backbone/#Model-constructor