javascript - How to access object from parent in custom if helper? -
the ../../message.notavailable
in ifequal helper doesn't seem work if provide string "hello" compare type works fine , comes inside loop
{{#ifequal type ../../message.notavailable}} <li id="{{id}}"><a href="#">{{../../../message.notavailable}}</a> </li> {{/ifequal}}
my helper:
handlebars.registerhelper('ifequal', function(value1, value2, options) { if(value1 === value2) { return options.fn(this); } return options.inverse(this); });
edit:
i have tried removing ../../
variable doesn't seem work.
if message.notavailable
in parent template scope, use ../message.notavailable
.
the
../
path segment references parent template scope, not 1 level in context.
Comments
Post a Comment