What is the preferred way, if any, to instantiate a Backbone model from an existing model, assuming that the model to be instantiated is of a derived type of the existing model?
The case I have in mind arises when dealing with nested models. For instance, let's say I am using DeepModel
and I define a function on my "parent" model that returns this.get("childModel")
. Now the child model is likely of type Backbone.Model
but I would like it to be of type ChildModel
which extends Backbone.Model
. I have been doing this by literally copying over the interesting attributes one at a time. Surely there must be a better way...