5

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.
givanse
  • 14,503
  • 8
  • 51
  • 75
blessanm86
  • 31,439
  • 14
  • 68
  • 79
  • 1
    Curly braces can be escaped using a backslash \\ example, http://emberjs.jsbin.com/valogusulo/1/edit?html,js,output – melc Dec 06 '14 at 14:26
  • @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. – blessanm86 Dec 06 '14 at 15:51
  • thanks I posted it, it may assist others. To be honest it wasn't very clear in other SO threads. This thread. https://github.com/wycats/handlebars.js/issues/146 helped. – melc Dec 06 '14 at 18:09

1 Answers1

6

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}}
melc
  • 11,523
  • 3
  • 36
  • 41