Simple way to escape curly braces?

后端 未结 1 1944
旧巷少年郎
旧巷少年郎 2021-01-22 09:35

Is there a simple way to build a string \"{value}\" with Handlebars? Perhaps something analogous to:

Handlebars.compile(\"\\{{{var}}\\}\")({var:\"value\"})


        
相关标签:
1条回答
  • 2021-01-22 10:37

    Handlebars support whitespace with the ~ character. The following should work

    Handlebars.compile("{ {{~var~}} }")({var:"value"})
    
    0 讨论(0)
提交回复
热议问题