I have a mustache template with a lambda looking like this:
{{#myfunc}}myvalue{{/myfunc}}
It is precompiled by hogan.js to look like this:
define(['hogan'],
function (Hogan) {
var template = new Hogan.Template(function (c, p, i) {
var _ = this;
_.b(i = i || "");
if (_.s(_.f("myfunc", c, p, 1), c, p, 0, 11, 18, "{{ }}")) {
_.rs(c, p, function (c, p, _) {
_.b("myvalue");
});
c.pop();
}
return _.fl();;
});
return function (context, partial, indent) {
return template.render(context, partial, indent);
};
});
I render the template using a Marionette.ItemView passing the lambda function into the Backbone.Model like this:
myfunc: function (key) { console.log("key", key); }
The weird thing: The function myfunc will be called and log to the console but it isn't passed a key by the template. I read about Hogan not supporting Lambda in precompiled mode (about a year ago - i guess this is fixed) - but if so how does it happen, that myfunc is called at all?
I put some debugging into my vendor/hogan.js lib - it looks like hogan cannot see the value between lambda-tags (here: myvalue).
Anyone seen this before?