handlebars.java icon indicating copy to clipboard operation
handlebars.java copied to clipboard

Javascript helper is not working

Open sadiasher opened this issue 5 years ago • 0 comments

Here is the custom javascript function that is used to assign value in a variable. I used it when I creating a template on UI http://tryhandlebarsjs.com/ and it is working fine over there. but when I utilize it through your API, errors have been thrown.

Handlebars.registerHelper("var", function(name, value, context) { context.data.root[name] = value; });

how it is utilize in a template {{ var "$a" "abc" }}

how i register this throug API URI uri = new URI("/static/js/handlebars-helpers.js"); handlebars.registerHelpers(uri);

Error:

com.github.jknack.handlebars.HandlebarsException: /templates/test.hbs:2:3: :9 TypeError: Cannot set property "$a" of undefined

sadiasher avatar Jun 24 '19 06:06 sadiasher