ax1 / iridiumjs

🚀 Boost HTML horsepower
MIT License
1 stars 0 forks source link

add a data-counter or similar on array templates #15

Closed ax1 closed 2 years ago

ax1 commented 7 years ago

it would be great for arrays to add a data-index, data-counter or allow a position value.

the current way is by checking data-* properties for the real counter but it must be substrated manually

current

<li onclick="check(this)">{{0.value}}</li>
ir.controller.check = function(el) {
el.innerText.substring...

option1

<li data-index="0" onclick="check(this)">{{0.value}}</li>
ir.controller.check = function(el) {
el.dataset.index..

option2 ....thinking

ax1 commented 2 years ago

Implemented as autogenerated data-index="{{0}}" data-index="{{1}}" , etc. The index can be extracted later by reading that node or by using the r.model (name).indexOf() method