I haven't been able to find a solid example out there.
Template.registerHelper("itemLookup", function(sku, property){
return Items.findOne({sku: sku})[property];
});
How do I call this on the template?
I want to do something like:
{{ itemLookup sku="i3_4030U" property="title" }}
It should output
"Intel Core i3 4030U"
Do not name template helpers parameters, they will be passed in the same order to your helper function :
EDIT :
You can name parameters when including another template and you want to set its current data context to something else :
In the child template markup you'll be able to reference
{{param1}}
and{{param2}}
.Another Handlebars helpers feature available in Spacebars is the "hash" optional argument value you can pass as the last argument to your helper parameters, you can use it like this :
HTML
JS