Created
March 28, 2014 21:12
-
-
Save NickRSearcy/9843078 to your computer and use it in GitHub Desktop.
Meteor jade+coffeescript question
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
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 | |
) |
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
<head> | |
<title>test</title> | |
</head> | |
<body> | |
{{> hello}} | |
</body> | |
<template name="hello"> | |
<h1>Hello World!</h1> | |
{{greeting}} | |
<input type="button" value="Click" /> | |
</template> |
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
head | |
title turk | |
body | |
+hello | |
template(name="hello") | |
h1 Hello World! | |
{{greeting}} | |
input(type="button" value="Click") |
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
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