I have created a ParentModel and few other models which extend ParentModel. Each ChildModel has some additional properties than ParentModel.
I want to call defaults method of ParentModel and get that JSON and add some additional properties and return the modified object from the defaults of ChildModel.
Here is my code:
var ParentModel = Backbone.Model.extend({
defaults: function() {
return {
name: '',
description: '',
ruleType: '',
creationDate: ''
};
}
});
var ChildModel = ParentModel.extend({
defaults: function() {
//Q: How to get the defaults from ParentModel and add one more property to json
}
});
var c = new ChildModel({});
But I am unable to figure out How to call the defaults method of the class it is extending (ParentModel) ?
_.extend({extraProps:here}, ParentModel.prototype.defaults)