I'm using the play framework template engine based on scala. The controller are written in Java.
Is there a way to define a inline writable variable?
I just found this at the documentation:
@defining(user.getFirstName() + " " + user.getLastName()) {
<div>Hello @fullName</div>
}
But this only create a readonly variable.
Edit: I am using a loop in my html page:
@for(variable <- variables) {
This kind of a loop dosen't give me a index variable. I need this index to give different outputs for the first loop and all others. Hope this is clear?
So I just thought I could create a index variable outside the loop and increment it on each loop.
Has anyone an idea? Thanks
Try:
@for(for(i <- 0 to list.size-1) {
@list(i)
}
or simply:
@for(i <- list.indices) {
@list(i)
}
(tip from google group)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With