node package manager
Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »


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.


$ 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.

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


var RecursiveModel = require('backbone-recursive-model');
var MyModel = RecursiveModel.extend({});


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