Skip to content

Instantly share code, notes, and snippets.

@dru
Created July 26, 2012 16:30
Show Gist options
  • Save dru/3183077 to your computer and use it in GitHub Desktop.
Save dru/3183077 to your computer and use it in GitHub Desktop.
Meteor quick start
<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>
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