each-[item] iteration index has for name %item%#552
each-[item] iteration index has for name %item%#552Duder-onomy merged 1 commit intomikeric:masterfrom
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.