0

In my Clojure program (using Hiccup), I'm looking to get the value of a text field when a user clicks on a button, and then append that date to a URL. I've attempted to use "ng-model" from AngularJS, however this results in the following error:

java.net.URISyntaxException: Illegal character in path at index 11: /dashboard/{{date}}

The code I currently use is below:

(text-field {:class "form-control" :ng-model "date"} "date" date)
[:a {:class "btn btn-primary" :href "/dashboard/{{date}}"} "Submit"]
podomunro
  • 495
  • 4
  • 16

1 Answers1

0

It looks like hiccup is converting the string of your link into an URI and this is causing a problem.

An easy way to get out of the problem would be to avoid using that helper for angular links and directly creates an a tag:

[:a {:class "btn btn-primary" :href "/dashboard/{{date}}"} "Submit"]
Axnyff
  • 9,213
  • 4
  • 33
  • 37
  • Thanks for your answer. How do I get the value from my text field though? Do I use the text-field's ID that I gave it? – podomunro Apr 15 '18 at 21:47
  • That is related to angular, you need to make the html rendered from clojure compatible with angular to make it work – Axnyff Apr 15 '18 at 21:54