0

我正在编写一个带有打嗝标记的 AngularJS 应用程序。标记是这样的

<div modal-show modal-visible="showDialog" .........></div>

我写的相应的打嗝是这样的:

[:div.modal.fade
  {  :modal-show 
     :modal-visible "showDialog"
     :aria-hidden "true",
     :aria-labelledby "terms-n-services-modal-label",
     :role "dialog",
     :tabindex "-1"}
    [:div.modal-dialog
     [:div.modal-content
      [:div.modal-header
       [:button.close
        {:aria-hidden "true", :data-dismiss "modal", :type "button"}
        "×"]
       [:h4#terms-n-services-modal-label.modal-title "Terms & Services "]]
      [:div.modal-body ""]
      [:div.modal-footer
       [:button.btn.btn-default
        {:data-dismiss "modal", :type "button"}
        "Close"]]]]]

现在尝试运行我的代码时出现此错误:

java.lang.RuntimeException:映射文字必须包含偶数个表单,编译

现在我知道,地图文字将无法表示:modal-show因为它没有它的值/RHS 来配对。

我应该怎么办 ?只写一个空字符串还是 null ?

4

1 回答 1

1

I think the best solution will be to set it on empty string. Result will be like modal-show="" but as far as I know it's gonna be interpreted in the same as just modal-show. If you want Hiccup to render just modal-show you probably need to dive into source, and add this function to it.

Check this out too: Are empty HTML5 data attributes valid?

于 2013-11-05T14:10:36.333 回答