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

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

qt - Errors in generated MOC files for QT5 from cmake -