bekite
bekite

Reputation: 3444

Aurelia repeat.for access index of item

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?

Upvotes: 66

Views: 19235

Answers (1)

Matthew James Davis
Matthew James Davis

Reputation: 12295

There is. Write this:

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

Upvotes: 119

Related Questions