Skip to content

Instantly share code, notes, and snippets.

@dburles
Created December 2, 2014 05:16
Show Gist options
  • Save dburles/7e6f8a1ae2c89b7f005d to your computer and use it in GitHub Desktop.
Save dburles/7e6f8a1ae2c89b7f005d to your computer and use it in GitHub Desktop.
default Meteor project using template session
if (Meteor.isClient) {
Template.hello.created = function() {
this.setDefault('counter', 0);
};
Template.hello.helpers({
counter: function() {
var template = Template.instance();
return template.get('counter');
}
});
Template.hello.events({
'click button': function(event, template) {
// increment the counter when button is clicked
template.set('counter', template.get('counter') + 1);
}
});
}
if (Meteor.isServer) {
Meteor.startup(function () {
// code to run on server at startup
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment