Created
May 28, 2015 07:01
-
-
Save chug2k/2605dcacde712745a531 to your computer and use it in GitHub Desktop.
ClickCounterView
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
$(function () { | |
var ClickCounterView = Thorax.View.extend({ | |
template: Handlebars.compile("<button class=\"btn\">Click Me!</button><h1>I've been pressed {{times}} times</h1>"), | |
initialize: function() { | |
this.times = 0; | |
}, | |
events: { | |
'click button': "onButtonClick" | |
}, | |
onButtonClick: function() { | |
this.times++; | |
this.render(); | |
// Remove this comment before submitting! | |
} | |
}); | |
var view = new ClickCounterView(); | |
view.appendTo('.container'); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment