Slide 18
Slide 18 text
app.TodoView = Backbone.View.extend({
template: _.template($('#item-template').html()),
events: {
'click .destroy': 'clear',
},
initialize: function () {
this.listenTo(this.model, 'destroy', this.remove);
},
render: function () {
this.$el.html(this.template(this.model.toJSON()));
}
clear: function() { //etc etc }
});