Indexing Items in Aurelia's Repeat

twitter logo github logo ・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!

twitter logo DISCUSS
Classic DEV Post from Jun 14 '19

FreeCodeCamp violated the rights of Medium authors

Ryan Bowlen - ATX Dev for Hire profile image
React / Java Developer who loves reading, working with youth, robotics, and making cool things.