At first you do not create a variable, and a value means read only.
In your example, you created a value fullNamethat is available inside curly braces.
@defining("Farmor") { fullName =>
<div>Hello @fullName</div>
}
Hello Farmor will be printed
To determine the value that is available globally in your template, simply enclose everything with your curly braces.
eg.
@defining("Value") { formId =>
@main("Title") {
@form(routes.Application.addPost, 'id -> formId) {
@inputText(name = "content", required = true)
<input type="submit" value="Create">
}
}
}
In this example, you can use the value of formIdanywere.
source
share