After trying various methods recommended on StackOverflow, I am still struggling to retrieve a Play Scala variable within my Javascript $scope. The line of initialization in an HTML file is as follows:
@(playVariable: String)(implicit request: play.api.mvc.Request[Any])
I am able to display this value between HTML tags as text on the screen by using something like:
<h2>Play value: @playVariable</h2>
However, I am unsure how to assign this variable to a $scope
value... Additionally, I don't believe that the Play @
character is valid within HTML tags, which leads to event.currentTarget.scalaVal
being undefined
in $scope.angularFunction
:
<button type="button" ng-click="angularFunction(parameter);" scalaVal=@playVariable>Click!</button>
I need to access @playVariable
within $scope.angularFunction
to pass it into a backend HTTP call... How can I achieve this?