Skip to content

Instantly share code, notes, and snippets.

@jasonporritt
Created May 6, 2011 12:33
Show Gist options
  • Save jasonporritt/958877 to your computer and use it in GitHub Desktop.
Save jasonporritt/958877 to your computer and use it in GitHub Desktop.
Use @vars -- translation of Backbone.js example app
initialize: ->
@model.bind('change', this.render)
@model.view = this
render: =>
$(@el).html(this.template(@model.toJSON()))
this.setContent()
return this
@fi-tomek-augustyn
Copy link

+1, you can go even further:

initialize: ->
  @model.bind('change', @render)
  @model.view = @

render: =>
  $(@el).html(@template(@model.toJSON()))
  @setContent()
  return @

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment