Created
May 6, 2011 12:33
-
-
Save jasonporritt/958877 to your computer and use it in GitHub Desktop.
Use @vars -- translation of Backbone.js example app
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
initialize: -> | |
@model.bind('change', this.render) | |
@model.view = this | |
render: => | |
$(@el).html(this.template(@model.toJSON())) | |
this.setContent() | |
return this |
+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
ok, and why not:
any problems with the above ?