Handlebars.js: Can't escape curly brackets

Created on 17 Nov 2017  路  1Comment  路  Source: handlebars-lang/handlebars.js

I'm trying to get the following output (bar will be replaced with a variable via handlebars.):

${bartest}

See code sandbox here.

Compiling the template with template({foo: 'bar'}), I have tried the following:

$\\{{{foo}}test} results in ${{{foo}}test}
${{{foo}}test} results in compile error (Expecting 'CLOSE_UNESCAPED', 'OPEN_SEXPR', 'ID', 'STRING', 'NUMBER', 'BOOLEAN', 'UNDEFINED', 'NULL', 'DATA', got 'CLOSE')

How does one replace foo with bar?

Most helpful comment

You can use whitespace control: ${ {{~foo~}} test} (http://handlebarsjs.com/expressions.html#whitespace-control)

>All comments

You can use whitespace control: ${ {{~foo~}} test} (http://handlebarsjs.com/expressions.html#whitespace-control)

Was this page helpful?
0 / 5 - 0 ratings