Aurelia repeat.for access index of item

帅比萌擦擦* 提交于 2019-12-03 14:17:43

问题


I have a simple repeat.for:

<li repeat.for="item of items">${item}</li>

Currently I'm using: ${$parent.items.indexOf(item)}. Is there a shorthand, something like {{$index}} in angular?


回答1:


There is. Write this:

<li repeat.for="item of items">${$index} - ${item}</li>


来源:https://stackoverflow.com/questions/28418345/aurelia-repeat-for-access-index-of-item

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!