You can use fold. I think your problem is the parenthesis. Did you try with curly brackets?
@productOpt.fold{
<em>-</em>
}{ p =>
@display(product = p)
}
Question
The documentation has an example of using map
@products.map { p =>
@display(product = p)
}
Can I use fold
like?
@productOpt.fold(
<em>-<em>
){ p =>
@display(product = p)
}
How should I arrange the code in the template (the above example does not work)?
La solution
You can use fold. I think your problem is the parenthesis. Did you try with curly brackets?
@productOpt.fold{
<em>-</em>
}{ p =>
@display(product = p)
}