4
votes

I am trying to display a handlebars code sample in my Ember App. The sample would look like

{{#bm-select}}
  {{#bm-selected}}
    {{name}}
  {{/bm-selected}}
{{/bm-selected}}

How could I add this to my template and make handlebars not process it? I just want to display the code like above.

  • I tried stuff like \{{bm-select}}.
  • Using raw block helpers but I don't think Ember's Handlebars support this.
1
Curly braces can be escaped using a backslash \\ example, emberjs.jsbin.com/valogusulo/1/edit?html,js,output - melc
@melc i feel very stupid. Just had to add a \ to every curly brace. I just added on the top and thought it would affect every where. If you post this as an answer I will accept it. - blessenm
thanks I posted it, it may assist others. To be honest it wasn't very clear in other SO threads. This thread. github.com/wycats/handlebars.js/issues/146 helped. - melc

1 Answers

6
votes

Curly braces can be escaped in handlebars template using a backslash \ .

example,

emberjs.jsbin.com/valogusulo/1/edit?html,js,output

\{{#bm-select}}<br/>
  \{{#bm-selected}}<br/>
    \{{name}}<br/>
  \{{/bm-selected}}<br/>
\{{/bm-selected}}