Indexing Items in Aurelia's Repeat

bowlendev profile image Ryan Bowlen ・1 min read

Just a neat thing I learned today:

I am working on writing Selenium tests for an application written in Aurelia, and needed to access the index of items that are dynamically generated in a repeat.

The fix was simple. If you have the following:

<li repeat.for="price of prices"></li>

and in my case needed a unique id, you could do this:

<li id="${$index}" repeat.for="price of prices"></li>

Just thought that I would share!


Editor guide