I am trying to use the example mentioned for using the previous api in the Backbone Model. I pasted an example below
var bill = new Backbone.Model({
name: "Bill Smith"
});
bill.bind("change:name", function(model, name) {
alert("Changed name from " + bill.previous("name") + " to " + name);
});
bill.set({name : "Bill Jones"});
The previous value in the warning is Bill Smith, which is correct. But if I try to access this in firebug by calling
bill.previous("name");
this is bill jones, not bill smith. Why is this so? What am I missing?
rampr source
share