Skip to content

Instantly share code, notes, and snippets.

@hellogerard
Last active August 29, 2015 13:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hellogerard/9967016 to your computer and use it in GitHub Desktop.
Save hellogerard/9967016 to your computer and use it in GitHub Desktop.
[blaze] Meteor autofocus reactivity bug (https://github.com/meteor/meteor/issues/2011)
<head>
<title>cow</title>
</head>
<body>
{{> hello}}
</body>
<template name="hello">
<h1>Hello World!</h1>
{{greeting}}
<input type="button" value="Click" />
<input type="text" value="{{dog}}">
</template>
if (Meteor.isClient) {
Template.hello.greeting = function () {
return "Welcome to cow.";
};
Template.hello.dog = function () {
return Session.get('dog');
};
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