I have a template named mainBodywith the form:
@(title: String)(html: Html, moreScripts: Html = Html(""))
I can call it like
views.html.mainBody("All properties")(views.html.showProperties(list))
views.html.showProperties()- another template. I get the impression that templates are just functions that return Html. However, if I extend this to:
views.html.mainBody("All properties")(views.html.showProperties(list), views.html.showPropertiesScripts)
Where views.html.showPropertiesScriptsis just a template with some HTML code, I get an error:
play.PlayExceptions$CompilationException: Compilation error[type mismatch;
found : views.html.showPropertiesScripts.type
required: play.twirl.api.Html]
at play.PlayExceptions$CompilationException$.apply(PlayExceptions.scala:27) ~[na:na]
at play.PlayExceptions$CompilationException$.apply(PlayExceptions.scala:27) ~[na:na]
at scala.Option.map(Option.scala:145) ~[scala-library-2.11.2.jar:na]
at play.PlayReloader$$anon$1$$anonfun$play$PlayReloader$$anon$$taskFailureHandler$1.apply(PlayReloader.scala:234) ~[na:na]
at play.PlayReloader$$anon$1$$anonfun$play$PlayReloader$$anon$$taskFailureHandler$1.apply(PlayReloader.scala:229) ~[na:na]
I do not understand this. Instead of the expected type Html, views.html.showPropertiesScriptsis there views.html.showPropertiesScripts.type? What is it and why views.html.showPropertiesScriptsnot type Html(like my other templates)?
source
share