1

如何创建没有价值的属性。

我想创建这样的(可能是无效的)html。注意ng-appng-jq- 没有值的属性。

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

在 scalatags 中,您将从以下内容开始:

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

1 回答 1

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`)
于 2016-09-27T07:30:22.170 回答