In java, equals helper returns java.lang.IllegalArgumentException: "could not find helper: 'eq'"
For two variables, boolean "skip" and string "name", I'm trying to make this not print anything if "skip" is true
{{# eq skip "false"}} {{name}} {{/eq}}
Results in
"could not find helper: 'eq'"
I get the same behavior if I use "equals" or "equal" instead of "eq" for the helper
It seems that using "{{#if skip}}{{else}}" is sufficient, but I'd like to understand the eq helper
For two variables, boolean "skip" and string "name", I'm trying to make this not print anything if "skip" is true
{{# eq skip "false"}} {{name}} {{/eq}}Results in "could not find helper: 'eq'"I get the same behavior if I use "equals" or "equal" instead of "eq" for the helper
It seems that using "{{#if skip}}{{else}}" is sufficient, but I'd like to understand the eq helper
@keanerickson-mc - I had faced the very similar issue, but the below solution worked and template loaded as expected.
Error trace -
IllegalArgumentException: could not find helper: 'eq'] with root cause
java.lang.IllegalArgumentException: could not find helper: 'eq'
You can try with a custom code. Register the necessary class (ConditionalHelpers.eq) in your case.
private final Handlebars handlebars;
handlebars.registerHelper("eq", ConditionalHelpers.eq);
Now consume the above handlerbars in your service -
Template handlerBarTemplate = handlebars.compileInline(template);
handlerBarTemplate.apply(context, writer);