Keep nested model event bindings and instances alive after root model.set or save.
JavaScript
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
test
.gitignore
.npmignore
LICENSE
README.md
index.js
package.json

README.md

Backbone Recursive Model

Is this for me?

If you need to nestle Backbone models in each other and keep instance references and event bindings after .save(), then this is the ticket.

Node.js

$ npm install backbone backbone-recursive-model

Backbone is not set as a dependency in the package.json but is required to be installed to use the RecursiveModel class. The reason for this is because you need to share the same instance of Backbone.

require('backbone-recursive-model');
var Backbone = require('backbone');

var MyModel = Backbone.RecursiveModel.extend({});

Or

var RecursiveModel = require('backbone-recursive-model');

var MyModel = RecursiveModel.extend({});

Browser

Just include the index.js file in a script tag together with Backbone and your ready to go.