Question

I have received this error message when I'm passing <script></script> into a scala written view page:

missing arguments for method apply in object main; follow this method with `_' if you want to treat it as a partially applied function

The error page marks this part out:

{
    <script src="@routes.Assets.at("javascripts/foundation/foundation.forms.js")"></script>
    <script src="@routes.Assets.at("javascripts/foundation/foundation.abide.js")"></script>
}

This part corresponds to my last parameter on Main.scala.html page (FoundationJS part)

@(topNav:Html=Html.empty)(content:Html)(footer:Html=Html.empty)(customCSS:String="")(customJS:String="")(modalWindows:Html=Html.empty)(FoundationJS:Html=Html.empty)

Should I change it and pass in strings instead of script tags?

Was it helpful?

Solution

Make sure your opening curly-brace for each parameter block is on the same line as the closing curly-brace of the previous parameter block, otherwise you'll get that error.

Taking only content and footer as an example:

<!-- this will work -->
@Main(){
  <p>Content</p>
} {
  <p>Footer</p>
}

<!-- this won't -->
@Main(){
  <p>Content</p>
}
{
  <p>Footer</p>
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top