Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting index within Each Helper #161

Closed
alexQueue opened this issue Jun 25, 2014 · 6 comments
Closed

Getting index within Each Helper #161

alexQueue opened this issue Jun 25, 2014 · 6 comments

Comments

@alexQueue
Copy link

This works in Handlebars:

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

This fails in Emblem:

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

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

Perhaps this is not an issue, but I thought Emblem was intended to behave functionally like Handlebars.

@colinbellino
Copy link

I'm having the same issue, were you able to get this to work ?

@machty
Copy link
Owner

machty commented Jul 13, 2014

Are you sure you're on the latest Emblem? This seems to work:

http://jsbin.com/ucanam/5701

@colinbellino
Copy link

So i did some digging and it turns out the problem come from a bug in the ember-template-compiler module that is used by ember-cli (via broccoli-emblem-compiler).

I found a solution to my problem (see below), thanks for your answer, it helped a lot ;)

If anyone else is having this issue, here is what i found :

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

@machty
Copy link
Owner

machty commented Jul 13, 2014

Doesn't seem like a bug/missing feature for this repo.

@machty machty closed this as completed Jul 13, 2014
@machty
Copy link
Owner

machty commented Jul 13, 2014

Thanks @cbellino for digging in :)

@dishcandanty
Copy link

dishcandanty commented Aug 10, 2017

In case anyone runs into it today and finds this like I did:

each list as |item index|
      = index

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants