Skip to content

Instantly share code, notes, and snippets.

@marti1125
Created May 19, 2013 07:50
Show Gist options
  • Save marti1125/5607000 to your computer and use it in GitHub Desktop.
Save marti1125/5607000 to your computer and use it in GitHub Desktop.
Backbone 03 codeschool - view
var AppointmentView = Backbone.View.extend({
tagName: 'li',
className: "appointment",
});
var AppointmentView = Backbone.View.extend({
render: function(){
this.$el.html('<li>' + this.model.get('title') + '</li>');
}
});
var AppointmentView = Backbone.View.extend({
template: _.template('<span><%= title %></span>'),
render: function(){
this.$el.html(this.template(this.model.toJSON()));
}
});
var AppointmentView = Backbone.View.extend({
template: _.template('<span><%= title %></span>'),
events: {
"click span": "alert"
},
alert: function(){
alert(this.model.get('title'));
},
render: function(){
this.$el.html(this.template(this.model.toJSON()));
}
});
var AppointmentView = Backbone.View.extend({
template: _.template('<span><%= title %></span>'),
events: { "dblclick": "alertTitle" },
alertTitle: function(){
alert(this.model.get('title'));
},
render: function(){
this.$el.html(this.template(this.model.toJSON()));
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment