javascript - How to call the defaults method of parent model in backbone -
i have created parentmodel , few other models extend parentmodel. each childmodel has additional properties parentmodel.
i want call defaults method of parentmodel , json , add additional properties , return modified object defaults of childmodel.
here code:
var parentmodel = backbone.model.extend({ defaults: function() { return { name: '', description: '', ruletype: '', creationdate: '' }; } }); var childmodel = parentmodel.extend({ defaults: function() { //q: how defaults parentmodel , add 1 more property json } }); var c = new childmodel({});
but unable figure out how call defaults method of class extending (parentmodel) ?
_.extend({extraprops:here}, parentmodel.prototype.defaults)
Comments
Post a Comment