Exclude model properties when syncing (Backbone.js)

后端 未结 11 1403
甜味超标
甜味超标 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:51

    If it is a one-off occasion, you could use mode.unset('selected', { silent:true }) (silent is set only to avoid firing the change event), to remove the attribute... This has the not so nice counter-effect of having to re-set it after saving though.

    This said, I totally endorse one of the solutions above. Moreover if this is something you need on a more regular basis.

提交回复
热议问题