Declare variable in a Play2 scala template

前端 未结 8 1596
谎友^
谎友^ 2020-11-27 17:33

How do you declare and initialize a variable to be used locally in a Play2 Scala template?

I have this:

@var title : String = \"Home\"
8条回答
  •  旧时难觅i
    2020-11-27 18:21

    If you don't want to wrap all your content with @defining, you can do this :

    @yourVariable = { yourValue }
    

    The @defining directive is really unreadable in a template...

提交回复
热议问题