3

I am using Play 2.3 with Scala 2.11.6 and Angular. I have a page template that contains an Angular application.

However, if I use $index in a Scala template like this:

<div ng-repeat="message in messages track by $index">{{message}}</div>

, I will get this warning during the compilation.

possible missing interpolator: detected interpolated identifier `$index`

I tried to escape dollar sign with $$index, but it didn't work.

angelokh
  • 9,426
  • 9
  • 69
  • 139

1 Answers1

0

You can use the Unicode encoding for dolar: @{"\u0024"}index.

<div ng-repeat="message in messages track by @{"\u0024"}index">{{message}}</div>

Comments

  • The problem exists in scala-2.11. It works in scala-2.10.
  • There is also the option to disable the entire warning by compiling with -Xlint:-missing-interpolator.
raisercostin
  • 8,777
  • 5
  • 67
  • 76