Search code examples
aureliatemplating

Binding Expression in Aurelia if.bind


I would like to put in a simple expression to a template in Aurelia.

When working in a loop of <span repeat.for="link of links">, I want to show a '/' between all items, except after the last one.

I would expect I could use the following:

<span if.bind="${$index + 1} !== ${links.length}"> / </span>

But this gives me the following error:

Uncaught (in promise) Error: Parser Error: Missing expected : at column 10 in [${$index + 1} !== ${links.length}]

Is there a way I can do this?


Solution

  • Try if.bind="$index !== links.length - 1" instead of doing string interpolation. That should make it work.