Skip to content

Instantly share code, notes, and snippets.

@possibilities
Created June 2, 2012 21:32
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 possibilities/2860010 to your computer and use it in GitHub Desktop.
Save possibilities/2860010 to your computer and use it in GitHub Desktop.
<head>
<title>render-test</title>
</head>
<body>
</body>
<template name="roomList">
<div id="roomList">
<ul>
{{#each rooms}}
<li>{{name}}</li>
{{/each}}
</ul>
</div>
</template>
if (Meteor.is_client) {
Chatrooms = new Meteor.Collection('chatRooms');
Meteor.subscribe('chatRooms');
var rooms = Chatrooms.find();
Meteor.startup(function() {
$('body').append(
Meteor.ui.render(function() {
return Template.roomList({ rooms: rooms });
})
);
});
}
if (Meteor.is_server) {
Chatrooms = new Meteor.Collection('chatRooms');
Chatrooms.remove({});
Chatrooms.insert({
name: 'moof'
});
Chatrooms.insert({
name: 'doof'
});
Meteor.publish('chatRooms', function() {
return Chatrooms.find();
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment