why option html element is not binded inside select in case 1?
Case 1: not work
@base{
<select name="" value="" class="custom-select">
@{
println("1"); // this is printed to console
<option value="test">i</option> // this is not shown in html
println("2"); // this is printed to console
}
</select>
}
Case 2: work
@base{
<select name="" value="" class="custom-select">
@{
println("1"); // this is printed to console
<option value="test">i</option> // this is shown in html
}
</select>
}
Update:
How one can create a loop which binds all option elements to scala template? Following code does not bind any option elements. What is actually return type? Empty line?
<select name="" value="" class="custom-select">
@{
for(i <- 1 to 10) {
<option value="@i">@i</option>
}
}
</select>