Make you function like that and you can call from html file.
'myFunction':function(param) {
{...}
}
Example
placePage.html
<template name="PlacePage">
{ ... }
{{#each this.places}}
<div class="input-group">
Place name:
{getPlaceName this._id}}
</div>
{ ... }
</template>
placePage.js
Template.PlacePage.helpers({
'getPlaceName':function(id) {
if ( id === undefined || id.length < 1 ){
return "";
} else {
var place = Places.findOne({_id:id});
if ( place === undefined){
return "";
} else {
return place.name ;
}
}
}
});
1 Comment