【问题标题】:Add attribute without value scalatags添加没有值scalatags的属性
【发布时间】:2017-02-04 17:20:29
【问题描述】:

如何创建没有值的属性。

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

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

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

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

【问题讨论】:

    标签: scala scala.js scalatags


    【解决方案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`)
    

    【讨论】:

      猜你喜欢
      • 2015-02-26
      • 2015-05-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-10-04
      相关资源
      最近更新 更多