Easiest way to reset Backbone's model to initial defaults?

Viewed 41813

My models already have a defaults hash. When parts of the view/page are reset, I wish to reset the models back to their original defaults.

Currently, I explicitly set each attribute to its default value. Is there anything built in or a JavaScript/Underscore.js/Backbone.js/jQuery function that I could use to do this in a single statement?

7 Answers

My solutions is:

model.clear({silent: true}).set(model.defaults);
Related