Could not find implicit value for parameter flash

Viewed 8757

I'm trying to port some code from Play Framework Java to Play Framework Scala but I'm having some issues with porting a tag.

The tag in question in the Java version checks the contents of the Flash scope and creates notifications to the user according to its values (error, success, etc).

I tried to create a Scala view (flag.scala.html):

@()(implicit flash:play.mvc.Scope.Flash)

@if(flash.get("error")) {
    <p style="color:#c00">
        @flash.get("error")
    </p>
}

Which I call from main.scala.html via:

@views.Application.html.flag()

The error I get is:

The file {module:.}/tmp/generated/views.html.main.scala could not be compiled. Error raised is : could not find implicit value for parameter flash: play.mvc.Scope.Flash

The call to the new tag is correct, as if I replace the content by some String that's shown in the browser.

I'm sure it's something stupid but I got stuck. Any suggestion?

4 Answers
Related