I'm pretty new to backbone and I'm reading, following its example to create a todo list. I can't figure out why this piece of code does not work:
var Todo= Backbone.Model.extend({
defaults: {
title : "",
completed : false
},
initialize: function(){
console.log("model initialized");
this.on("change", function(){
console.log("values for this model have changed.");
});
}
});
var todo1= new Todo();
the libraries I've included are jquery, underscore and backbone. What's wrong with this? Why ".on" is not available? Thanks