admin管理员组文章数量:1025457
I have "name" variable in the view and I want to display something like this in the rendered HTML:
${Jon}
Right now, my code is like this:
<li>
{{name}}
</li>
I am storing name
in the view directly as "${" + model.name + "}"
. But I dont want to store names this way, I want to display the characters $
, {
and }
in the handlebars template.
How to you escape { and } in the handlebars to be normal strings?
I have "name" variable in the view and I want to display something like this in the rendered HTML:
${Jon}
Right now, my code is like this:
<li>
{{name}}
</li>
I am storing name
in the view directly as "${" + model.name + "}"
. But I dont want to store names this way, I want to display the characters $
, {
and }
in the handlebars template.
How to you escape { and } in the handlebars to be normal strings?
Share Improve this question asked Apr 29, 2013 at 5:34 Dhwaneet BhattDhwaneet Bhatt 5861 gold badge8 silver badges19 bronze badges1 Answer
Reset to default 4You can use the HTML ASCII code:
{ = '{'
} = '}'
example:
<li>{{{item}}}</li>
if item = 'apple'
, then this bees:
{apple}
JSBin example
I have "name" variable in the view and I want to display something like this in the rendered HTML:
${Jon}
Right now, my code is like this:
<li>
{{name}}
</li>
I am storing name
in the view directly as "${" + model.name + "}"
. But I dont want to store names this way, I want to display the characters $
, {
and }
in the handlebars template.
How to you escape { and } in the handlebars to be normal strings?
I have "name" variable in the view and I want to display something like this in the rendered HTML:
${Jon}
Right now, my code is like this:
<li>
{{name}}
</li>
I am storing name
in the view directly as "${" + model.name + "}"
. But I dont want to store names this way, I want to display the characters $
, {
and }
in the handlebars template.
How to you escape { and } in the handlebars to be normal strings?
Share Improve this question asked Apr 29, 2013 at 5:34 Dhwaneet BhattDhwaneet Bhatt 5861 gold badge8 silver badges19 bronze badges1 Answer
Reset to default 4You can use the HTML ASCII code:
{ = '{'
} = '}'
example:
<li>{{{item}}}</li>
if item = 'apple'
, then this bees:
{apple}
JSBin example
本文标签: javascriptHow to escape characters in HandlebarsStack Overflow
版权声明:本文标题:javascript - How to escape characters in Handlebars - Stack Overflow 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://it.en369.cn/questions/1745634075a2160337.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论