model.previous

previousmodel.previous(attribute)
During a "change" event, this method can be used to get the previous value of a changed attribute.

var bill = new Backbone.Model({
  name: "Bill Smith"
});

bill.on("change:name", function(model, name) {
  alert("Changed name from " + bill.previous("name") + " to " + name);
});

bill.set({name : "Bill Jones"});
doc_Backbone
2016-04-17 12:21:41
Comments
Leave a Comment

Please login to continue.