如何将更改事件绑定到模型从视图更改名称并在视图块中显示更改的名称。
Student = Backbone.Model.extend({
initialize: function(){
this.on("change:name", function(model){
var name = model.get("name");
alert("Changed my name to " + name );
});
}
});
var pe = new Student({ name: "sinduja", age: 20});
pe.set({name: 'shalini'});