backbone.js set callback on before save? -
i asked remove couple of attributes backbone model (which optional) exists. first intent place before_save callback on model. didn't find information googling.
possible on backbone side?
just override default model.save , add callback it.
var mymodel = backbone.model.extend({ save: function (key, val, options) { this.beforesave(key, val, options); return backbone.model.prototype.save.call(this, key, val, options); }, beforesave: function (key, val, options) { } }) if want remove particular attributes being sent server may override model.tojson method.
Comments
Post a Comment