Created
March 30, 2012 15:29
-
-
Save smsohan/2252292 to your computer and use it in GitHub Desktop.
backbonejs example
This file contains 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
Vehicle = Backbone.Model.extend({defaults: { make: '', model: ''}}) | |
VehicleView = Backbone.View.extend({ | |
initialize: () -> | |
this.model.bind 'change', this.render, this | |
render: () -> | |
this.$el.html(this.template(this.model.toJSON())) | |
this | |
}) | |
new VehicleView({model: new Vehicle}).render() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment