Prasanth A R
Prasanth A R

Reputation: 4174

how to invoke scala method in play framework view page

I'am in new in play framework and i have a doubt about these questions any experts in play framework shouldanswer these questions

In play framework the scala methods are how to invoke inside view ?

these method will create inside the application or model in the project

with regards, Prasanth AR

my language is not good I know, and sorry about that

Upvotes: 1

Views: 235

Answers (1)

4lex1v
4lex1v

Reputation: 21557

To define a method inside Twirl's template add @ before the name and code block

@incr(number: Int) = @{ @number + 1 }

To invoke scala method or variable add @ symbol before the name

<div>@incr(10)</div>

Will return and print 11 in div block

Upvotes: 3

Related Questions