2016-09-27 1 views
1

So erstellen Sie ein Attribut ohne Wert.Attribut ohne Wert hinzufügen scalags

Ich möchte solche (vielleicht nicht gültige) HTML erstellen. Hinweis ng-app und ng-jq - Attribute ohne Werte.

<html ng-app ng-jq> 
... 
... 
</html> 

In scalatags würden Sie beginnen mit:

import scalatags.JsDom.all._ 
html(
    //and here what? 
) 

Antwort

1
import scalatags.JsDom.all._ 
val `ng-app` = "ng-app".attr := "" //empty string does the job 
val `ng-jq` = "ng-jq".attr := "" 

html(`ng-app`, `ng-jq`) 

Update

In scalatags-0.6.0 wird dies noch deutlicher:

import scalatags.JsDom.all._ 
val `ng-app` = attr("ng-app") := "" //empty string does the job 
val `ng-jq` = attr("ng-jq") := "" 

html(`ng-app`, `ng-jq`)