So I'm starting to learn clojurescript and I'm checking out different tutorials on it. One thing I wasn't able to find out is to target an element id on a certain html file to put my markups.
Let's say I have two html files, index.html and about.html. I want to target my code below to the element id "app" on about.html when the url is pointing to http://localhost:3449/about
code :
(om/root
(fn [data owner]
(reify
om/IRender
(render [_]
(dom/p nil (:text data)))))
app-state
{:target (. js/document (getElementById "app"))})
What would be the best approach to do this? Or maybe a reference so I can look at it. Or maybe I'm missing some point here and maybe someone can enlighten me.
Also I have tried using this https://github.com/gf3/secretary but I'm not sure if it's a better approach since urls must have a hashkey(http://localhost:3449/#/about) to trigger.
Update:
So I have used the answer below and it did work but I faced some problem before making it to work. In any case somebody run into this post and have used the answer below but got an undefined issue check my final code.
:cljsbuild
section of your project.clj
:cljsbuild {:builds [{ :id "dev"
:source-paths ["src/clj" "src/cljs"]
:compiler {:output-to "resources/public/js/main.js"
:output-dir "resources/public/js/out/"
:optimizations :none
:pretty-print true}}]}
included js files on about.html
<script src="js/out/goog/base.js" type="text/javascript"></script>
<script src="js/main.js" type="text/javascript"></script>
<script type="text/javascript">goog.require("om_async.about");</script>
<script type="text/javascript">om_async.about.init();</script>