Jack Chi
Jack Chi

Reputation: 440

Angular.js and Play Framework 2.1 Integration with helper functions

I want to use Angular.js with the Play Framework view helper functions (e.g @helper.form(...))

How do I insert an Angular directive (e.g: ng-controller)

enter image description here

Upvotes: 2

Views: 891

Answers (2)

jetcom
jetcom

Reputation: 955

We're currently using Play Framework 2 and AngularJS.

We added a special method to handle this:

implicit class SymbolString( str: String ) {
    def s = Symbol(str)
  }

And then we just call it as such:

"ng-model".s -> "datasetName"

Upvotes: 1

Andrew Conner
Andrew Conner

Reputation: 1436

As I'm sure you discovered, you can't directly make a Scala Symbol with a dash like 'some-word. Instead, just wrap it:

scala> Symbol("ng-controller")
res4: Symbol = 'ng-controller

Upvotes: 2

Related Questions