Ember handlebars hyphen

I’m getting template error when I use a key with a hyphen in it. Handlebars supports this … Does anyone know how to get that working with Ember?

For an object like this:

   foo =  { "bars": [
                      {"hyphen-key": "value"}

and template like this:

{{#each foo.bars as |bar|}}

The error is:

Parse error on line 64:
...g >{{foo['hyphen-key']}

Broccoli Plugin: broccoli-persistent-filter:TemplateCompiler


Ember templates don’t support array syntax like that. Try just {{bar.hyphen-key}} or {{get bar 'hyphen-key'}}

1 Like

Hello @Panman8201 , You try using the get helper.

Something like this: {{get bar "hyphen-key"}}