In a twirl template I'm trying to render a loop of strings and the current code is giving me code errors. I'm sure it's a small detail that I'm missing...
This is my template...
@(title: String)(content: Html)
<!DOCTYPE html>
<html lang="en">
<head>
@* Here's where we render the page title `String`. *@
<title>@title</title>
</head>
<body>
@content
</script>
</body>
</html>
And this is where I use this template and try to do a for loop...
@(names: ("George", "John", "Ally"))
@list("List of names") {
<h1>Test</h1>
<ul>
@for(name <- names) {
<li>@name</li>
}
</ul>
}
And my controller...
package controllers;
import play.mvc.*;
public class NewController extends Controller {
public Result newPage() {
return ok(views.html.newPage.render());
}
}
Here is the error....
Compilation error
':' expected but identifier found.
In G:\Github\playExample - Copy\example\app\views\newPage.scala.html:10
6 @for(name <- names) {
7 <li>@name</li>
8 }
9 </ul>
10}
What am I missing?