The basic idea is to iterate through a folder, read all files inside, get their names and insert them to some html template as list of pages.
The iteration is no problem, but the inserting is harder for me.
My code (only basic logic):
Template (template.html)
<template name="myTemplate">
<p>{{myHelper}}</p>
</template>
Script (main.js)
if (Meteor.isServer) {
Meteor.methods({
myMethod: function(){
console.log("Hello");
return "Hi";
}
})
}
if (Meteor.isClient) {
Template.myTemplate.helpers({
myHelper: function(){
Meteor.call("myMethod");
}
})
}
From these actions I only get this output in the server console:
"Hello"
And my template contains an empty <p>
tag - I expect this: <p>Hi</p>
.
So my question is how to get the return value from myMethod
in the template?
If this gonna work, I would apply this logic to the iteration.
Or, is there some better way how to do all of this?