javascriptRouter

views.html.helper.javascriptRouter
object javascriptRouter extends BaseScalaTemplate[Appendable, Format[Appendable]]

Attributes

Graph
Supertypes
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: this.type
def render(name: String, routes: Array[JavaScriptReverseRoute], request: RequestHeader): Appendable

Inherited methods

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

Attributes

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

Attributes

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

Attributes

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

Attributes

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

Attributes

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

Attributes

Inherited from:
BaseScalaTemplate

Attributes

Inherited from:
Product

Attributes

Inherited from:
Product