When converting a Scala string list of strings to a javascript string array with a playback template engine, you probably start with something like this ...
var strArray = [@scalaListOfStrings.mkString(",")];
... and finds out that this does not work because there are no quotes around the lines. Then you can try something like this ...
var strArray = [@scalaListOfStrings.map(s => "\"" + s + "\"").mkString(",")];
... just to find out that it will wrap the lines in " and not. " The only way I was able to do this work was ...
var strArray = [@Html(scalaListOfStrings.map(s => "\"" + s + "\"").mkString(","))];
... and my question is: is this the best / only way to do this?
Rolling tritsch
source share