Aurelia repeat.for access index of item

Aurelia

Aurelia Problem Overview


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?

Aurelia Solutions


Solution 1 - Aurelia

There is. Write this:

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

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionbekiteView Question on Stackoverflow
Solution 1 - AureliaMatthew James DavisView Answer on Stackoverflow