Skip to content

Commit a9306ce

Browse files
committed
stop copyModelToView when model is changed by ourselves
1 parent f69c41a commit a9306ce

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

Backbone.ModelBinder.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,10 +211,14 @@
211211
return undefined;
212212
},
213213

214-
_onModelChange:function () {
214+
_onModelChange:function (model, options) {
215+
if (options && options.changeSource === 'ModelBinder'){
216+
return
217+
}
218+
215219
var changedAttribute, attributeBinding;
216220

217-
for (changedAttribute in this._model.changedAttributes()) {
221+
for (changedAttribute in model.changedAttributes()) {
218222
attributeBinding = this._attributeBindings[changedAttribute];
219223
if (attributeBinding) {
220224
this._copyModelToView(attributeBinding);

0 commit comments

Comments
 (0)