Skip to content

Instantly share code, notes, and snippets.

@chug2k
Created May 28, 2015 07:01
Show Gist options
  • Save chug2k/2605dcacde712745a531 to your computer and use it in GitHub Desktop.
Save chug2k/2605dcacde712745a531 to your computer and use it in GitHub Desktop.
ClickCounterView
$(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