Insert html in a handlebar template without escaping

╄→尐↘猪︶ㄣ 提交于 2019-11-27 06:38:52
Praveen

Try like

<p>{{{content}}}</p>

I got the official reference to support my answer:

Handlebars HTML-escapes values returned by a {{expression}}. If you don't want Handlebars to escape a value, use the "triple-stash", {{{.

In your template you must add triple mustaches like this. <p>{{{content}}}</p>

According to Handlebars documentation, http://handlebarsjs.com/expressions.html

Quote from documentation,

If you don't want Handlebars to escape a value, use the "triple-stash", {{{

Pass the raw HTML to Handlebars template and get the raw HTML output by using triple brackets.

{{{foo}}}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!