figuring out meteor
This commit is contained in:
@@ -10,11 +10,20 @@
|
|||||||
Here goes list of machines
|
Here goes list of machines
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
{{#each machines}}
|
||||||
|
{{> machineDetails}}
|
||||||
|
{{/each}}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- {{> hello}} -->
|
<!-- {{> hello}} -->
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
|
<template name="machineDetails">
|
||||||
|
<div class="col-lg-4">{{hostname}}</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
<template name="hello">
|
<template name="hello">
|
||||||
<button>Click Me</button>
|
<button>Click Me</button>
|
||||||
<p>You've pressed the button {{counter}} times.</p>
|
<p>You've pressed the button {{counter}} times.</p>
|
||||||
|
|||||||
@@ -1,7 +1,16 @@
|
|||||||
|
var Machines = new Mongo.Collection("machines");
|
||||||
|
|
||||||
if (Meteor.isClient) {
|
if (Meteor.isClient) {
|
||||||
// counter starts at 0
|
// counter starts at 0
|
||||||
Session.setDefault('counter', 0);
|
Session.setDefault('counter', 0);
|
||||||
|
|
||||||
|
Template.body.helpers({
|
||||||
|
machines: function() {
|
||||||
|
return [{hostname: 'machine1'}, {hostname:' machine2'}];
|
||||||
|
return Machines.find({});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
Template.hello.helpers({
|
Template.hello.helpers({
|
||||||
counter: function () {
|
counter: function () {
|
||||||
return Session.get('counter');
|
return Session.get('counter');
|
||||||
|
|||||||
Reference in New Issue
Block a user