Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save vangie/2979248 to your computer and use it in GitHub Desktop.
Save vangie/2979248 to your computer and use it in GitHub Desktop.
Extending the defaults of a Model superclass in Backbone.js
var ExtendedInventory = Inventory.extend({
defaults: {
rabit:25
}
});
_.extend(ExtendedInventory.prototype.defaults, Inventory.prototype.defaults);
// or
var ExtendedInventory = Inventory.extend({
defaults: _.extend({},Inventory.prototype.defaults,
{rabit:25}
)
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment