Created
May 19, 2013 07:50
-
-
Save marti1125/5607000 to your computer and use it in GitHub Desktop.
Backbone 03 codeschool - view
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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