DEV Community

Ryan Bowlen
Ryan Bowlen

Posted on

3 2

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)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs