[2.5.3 Scala] Generating a DI Reverse Route from Scala

15 views
Skip to first unread message

Michael Slinn

unread,
May 29, 2016, 3:56:07 PM5/29/16
to play-framework
When using dependency injected controllers, I can write the following in views/blah.scala.html:

<pre>@routes.AsyncController.message().url</pre>

... and the path for the reverse route for the desired Action is displayed. Very nice. I can also write:

<pre>@controllers.routes.AsyncController.message().url</pre>

... and the same information is displayed. However, if I write the following old-school code in a controller:

controllers.routes.AsyncController.message().url

... or I write the following in views/blah.scala:

object blah {
  def apply = Html("<pre>" + controllers.routes.AsyncController.message().url + "</pre>")
}


...then routes is undefined. How can a reverse route be created from Scala code when using DI controllers?

Naftoli Gugenheim

unread,
May 29, 2016, 4:54:48 PM5/29/16
to play-framework

Is that according to your IDE, or a according to the actual compiler?


--
You received this message because you are subscribed to the Google Groups "play-framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email to play-framewor...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/play-framework/d0bb6ed7-efb8-46d4-a5d6-e4ee42178537%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Michael Slinn

unread,
May 29, 2016, 5:03:56 PM5/29/16
to play-framework
Urg. I know about the misleading IDE error. I did not notice my other booboo. Please ignore this thread. Nothing to see, move along (to my other posting, perhaps?)
Reply all
Reply to author
Forward
0 new messages