2016-09-27 81 views
1

如何創建沒有價值的屬性。添加沒有價值的屬性scalatags

我想創建這樣的(也許無效的)html。注意ng-appng-jq - 沒有值的屬性。

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

在scalatags你會開始:

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

回答

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`) 

更新

在scalatags-0.6.0本變得更加明確:

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`)