javascriptRouter

views.html.helper.javascriptRouter
object javascriptRouter extends BaseScalaTemplate[Appendable, Format[Appendable]], Template3[String, Array[JavaScriptReverseRoute], RequestHeader, Appendable]

Attributes

Graph
Supertypes
trait Template3[String, Array[JavaScriptReverseRoute], RequestHeader, Appendable]
class BaseScalaTemplate[Appendable, Format[Appendable]]
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
Self type

Members list

Value members

Concrete methods

def apply(name: String)(routes: JavaScriptReverseRoute*)(implicit request: RequestHeader): Appendable

Generates a Javascript object that lets you refer to your application's routes in Javascript code

Generates a Javascript object that lets you refer to your application's routes in Javascript code

Example:

@javascriptRouter("jsRoutes")(
 routes.javascript.Users.list,
 routes.javascript.Application.index
)

You can access your routes in JavaScript without hardcoded URL's, e.g. assuming jQuery's ajax function:

$.ajax(jsRoutes.controllers.Users.list()).done( /* */ ).fail( /* */ )

Each action in the generated object also has the following properties:

  • type: HTTP method
  • url: the url to be used

Value parameters

name

The javascript object name.

routes

Set of routes to include in this javascript router.

Attributes

def f: String => Array[JavaScriptReverseRoute] => RequestHeader => Appendable
def ref: javascriptRouter.type.this.type
def render(name: String, routes: Array[JavaScriptReverseRoute], request: RequestHeader): Appendable

Inherited methods

def _display_(o: Any)(implicit m: ClassTag[Appendable]): T

Attributes

Inherited from:
BaseScalaTemplate
def _display_(x: Appendable): T

Attributes

Inherited from:
BaseScalaTemplate
def _display_(x: NodeSeq): T

Attributes

Inherited from:
BaseScalaTemplate
def _display_(x: Unit): T

Attributes

Inherited from:
BaseScalaTemplate
def _display_(x: String): T

Attributes

Inherited from:
BaseScalaTemplate
def _display_(x: AnyVal): T

Attributes

Inherited from:
BaseScalaTemplate

Attributes

Inherited from:
Product

Attributes

Inherited from:
Product