I'm attempting to utilize a basic handlebars helper, with arguments, in the framework of MeteorJS.
Allow me to provide an example:
{{#myList data className="myClassName"}}
{{name}}
{{/myList}}
The helper function is defined as follows:
Handlebars.registerHelper('myList', function(context, options) {
if (context && context.length){
var className = options.hash.className || "",
ret = "<ul class='"+ className +"'>";
for(var i=0, j=context.length; i<j; i++) {
ret = ret + options.fn(context[i]);
}
return ret + "</ul>";
}
});
However, the "hash" property always seems to be an empty array.
If I try a version like this one:
{{#myList data "myClassName"}}
{{name}}
{{/myList}}
The callback method never seems to receive the second argument.
Could there be something amiss in my approach?