Skip to content

Instantly share code, notes, and snippets.

@smsohan
Created March 30, 2012 15:29
Show Gist options
  • Save smsohan/2252292 to your computer and use it in GitHub Desktop.
Save smsohan/2252292 to your computer and use it in GitHub Desktop.
backbonejs example
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