I\'ve been experimenting with Meteor and ran into something I couldn\'t figure out. For fun, I was trying to make a slot machine. I had the following HTML:
&
This is what I have done to achieve it. I am fairly new to Meteor so there may be a better way:
Slot.html:
Slot
{{> slots}}
{{#each slots}}
{{> slot}}
{{/each}}
{{number}}
Slot.js:
if (Meteor.is_client) {
Template.slots.slots = function () {
var returnArray = new Array();
returnArray[0] = { 'number': 10 };
returnArray[1] = { 'number': 87 };
returnArray[2] = { 'number': 41 };
return returnArray;
};
}
if (Meteor.is_server) {
Meteor.startup(function () {
// code to run on server at startup
});
}
Hope this was some help to you!