3

I see that you can get the index within an each helper in handlebars with

{{#each array}}
    {{@index}}: {{this}}
{{/each}}

which I found in How to get index in Handlebars each helper?

This doesn't seem to work in Emblem though:

ul
  each App.things
    li {{@index}}

Uncaught Error: Emblem syntax error, line 1: Expected BeginStatement or DEDENT but "=" found. =@index

Am I doing something wrong?

Community
  • 1
  • 1
AlexQueue
  • 6,353
  • 5
  • 35
  • 44

1 Answers1

3

I had a similar problem and found the issue you opened on the emblem.js repository searching the web, the alternative syntax for #each did the trick:

ul
  each App.things
    li {{_view.contentIndex}}

Here is the link for people having the same issue using broccoli (and/or ember-cli) and emblem for more details: https://github.com/machty/emblem.js/issues/161#issuecomment-48853594

Hope this helps ;)

Colin
  • 31
  • 1