Meteor.methods({
getData() {
return 'Hello, world!';
}
});
<template name="someData">
{{#if someData}}
<p>{{someData}}</p>
{{else}}
<p>Loading...</p>
{{/if}}
</template>
Template.someData.onCreated(function() {
this.someData = new ReactiveVar();
Meteor.call('getData', (err, res) => {
this.someData.set(res);
});
});
Template.someData.helpers({
someData: function() {
return Template.instance().someData.get();
}
});
reactive-var
package required. To add it run meteor add reactive-var
.