Exclude model properties when syncing (Backbone.js)

后端 未结 11 1400
甜味超标
甜味超标 2020-12-07 14:26

Is there a way to exclude certain property from my model when I sync?

For example, I keep in my model information about some view state. Let\'s say I have a picker m

11条回答
  •  独厮守ぢ
    2020-12-07 14:48

    Set options.attrs will allow you customise api param:

    var model = new Backbone.Model();
    model.save(null, {
      wait: true,
      success: function() {
      },
      attrs: _.omit(model.attributes, 'selected')
    });
    

提交回复
热议问题