I am writing an AngularJS app with markup in hiccup. The mark-up is something like this
<div modal-show modal-visible="showDialog" .........></div>
The corresponding Hiccup I have written is this:
[: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"]]]]]
Now I get this error when try running my code:
java.lang.RuntimeException: Map literal must contain an even number of forms, compiling
Now I know, the map literal will not be able to represent :modal-show because it doesn't have its value/RHS to make a pair.
What should I do ? just write an empty string or null ?
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?