DEV Community

Ryan Bowlen
Ryan Bowlen

Posted on

Indexing Items in Aurelia's Repeat

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>
Enter fullscreen mode Exit fullscreen mode

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

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

Just thought that I would share!

Top comments (0)