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

Add index as an optional parameter to #each block params #10158

Closed
tim-evans opened this issue Jan 6, 2015 · 4 comments
Closed

Add index as an optional parameter to #each block params #10158

tim-evans opened this issue Jan 6, 2015 · 4 comments

Comments

@tim-evans
Copy link
Contributor

I would like to change the DOM styling of items according to their position.
The following image is an example of doing so in our app:

screen shot 2015-01-06 at 11 16 48 am

I would ideally like to write components that look at its index for rendering different display information:

{{#each emailAddresses as |emailAddress index|}}
  {{email-address-item email=emailAddress index=index}}
{{/each}}
@fivetanley
Copy link
Member

this would be amazing. I wonder if you can have multiple block params. @mmun @mixonic @rwjblue

@stefanpenner
Copy link
Member

@fivetanley you can (or will be able to). The index here would be lovely..

@mmun
Copy link
Member

mmun commented Jan 6, 2015

@tim-evans This should be easy to add if you're up for it. I think you can just change https://github.com/emberjs/ember.js/blob/master/packages/ember-views/lib/views/collection_view.js#L360 to [item, idx].

@tim-evans
Copy link
Contributor Author

Ok! It seems strange that the test for this belongs in ember-htmlbars. It's a tad confusing

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