Skip to content

Instantly share code, notes, and snippets.

@NickRSearcy
Created March 28, 2014 21:12
Show Gist options
  • Save NickRSearcy/9843078 to your computer and use it in GitHub Desktop.
Save NickRSearcy/9843078 to your computer and use it in GitHub Desktop.
Meteor jade+coffeescript question
if Meteor.isClient
console.log(Template.hello)
Template.hello.greeting = () -> "Welcome to test."
Template.hello.events({
'click input': () ->
# template data, if any, is available in 'this'
console.log("You pressed the button")
})
if Meteor.isServer
Meteor.startup( () ->
# code to run on server at startup
)
<head>
<title>test</title>
</head>
<body>
{{> hello}}
</body>
<template name="hello">
<h1>Hello World!</h1>
{{greeting}}
<input type="button" value="Click" />
</template>
head
title turk
body
+hello
template(name="hello")
h1 Hello World!
{{greeting}}
input(type="button" value="Click")
if (Meteor.isClient) {
Template.hello.greeting = function () {
return "Welcome to test.";
};
Template.hello.events({
'click input': function () {
// template data, if any, is available in 'this'
if (typeof console !== 'undefined')
console.log("You pressed the button");
}
});
}
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