-
Notifications
You must be signed in to change notification settings - Fork 309
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
each-[item] iteration index has for name %item% #552
Conversation
I believe it'd better to add attribute option or even custom binder. Something like this <div rv-each-todo="todos" rv-track-by="todoIndex"></div> This binder just gets index value and aliases it with another name |
Written like this, For this to work, the Binder Finally, is it really necessary to offer customization of index alias? If so, we could handle it with a configuration, like:
Too much customization could lead to less simplicity. |
I created a fiddle with possible examples how to implement this without touching rivets source: |
I suggest the |
@blikblim can you explain your idea more, I don't understand how it would work. |
The index value would be assigned to indexName instead of hardcoded to index. The previous syntax still valid. Although i think is not a really good syntax |
The colon might be a problem anyway http://stackoverflow.com/a/16021232/3098651 |
I don't think we need to add more syntax on the binders for index generation. It would concern only the |
I believe this is good idea and should be merged in. Questions: @jccazeaux Thanks for the PR. I am going to add the ability to configure the '%' syntax. This will ensure no naming conflicts, and people can name it whatever makes sense in the domain of their app. @stalniy You bring up a very important point about the I have updated and merged the PR. If anyone objects, please do so soon as we will be releasing a new version soon with this, and other updates. |
I think we should keep the old |
@Leeds-eBooks I didn't remove the old index in my PR ;-) |
👍 |
Implementation of suggested solution for #551
Tests are included.