Created
July 26, 2012 16:30
-
-
Save dru/3183077 to your computer and use it in GitHub Desktop.
Meteor quick start
This file contains hidden or 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>colors</title> | |
</head> | |
<body> | |
Colors: | |
{{> color_list}} | |
<hr/> | |
Atms: | |
{{> atms}} | |
<input type="text" name="email" id="loc"></input> | |
<input type="button" value="добавить" onclick="Atms.insert({location:document.getElementById('loc').value})"> | |
</body> | |
<template name="color_list"> | |
<ul> | |
{{#each colors}} | |
<li>{{ name }}</li> | |
{{/each}} | |
</ul> | |
</template> | |
<template name="atms"> | |
<ul> | |
{{#each atms}} | |
<li><b>{{ location }}</b></li> | |
{{/each}} | |
</ul> | |
</template> | |
This file contains hidden or 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
Colors = new Meteor.Collection("colors"); | |
Atms = new Meteor.Collection("atms"); | |
if (Meteor.is_client) { | |
Template.color_list.colors = function(){ | |
return Colors.find({}); | |
}; | |
Template.atms.atms = function(){ | |
return Atms.find({}); | |
};} | |
if (Meteor.is_server) { | |
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