Can someone explain to me what the Template function does in the following code:
object Users extends Controller {
def show(id:Long) = Template("user" -> User.findById(id))
}
Thanks.
It's syntactic sugar to create a template. In this example, it is a call to the function:
def Template(args: (Symbol, Any)*)
(defined here ). Itself just forwards the arguments to the ScalaControllerCompatibility
object (same file), that rewrites them so that the method, finally, creates a Template
instance.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.