Created
June 2, 2012 21:32
-
-
Save possibilities/2860010 to your computer and use it in GitHub Desktop.
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>render-test</title> | |
</head> | |
<body> | |
</body> | |
<template name="roomList"> | |
<div id="roomList"> | |
<ul> | |
{{#each rooms}} | |
<li>{{name}}</li> | |
{{/each}} | |
</ul> | |
</div> | |
</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
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