2

I have an elm 0.18 app that uses the Navigation module. I navigate within it using links that look like [ a [ href "/#/page" ] [ text "Page" ], and do redirects with Navigation.newUrl myNewUrl.

When I fire up elm-reactor, though, everything is coming from the location http://localhost:8000/src/main.elm/, and clicking the link above takes me to http://localhost:8000/#/page. This works fine with my webpack code, but it sends me back to the main page for elm-reactor.

What is the correct way to navigate different pages within an elm app and continue using elm-reactor?

glennsl
  • 28,186
  • 12
  • 57
  • 75
Mark Karavan
  • 2,654
  • 1
  • 18
  • 38

1 Answers1

0

Your links go back to the root of the site because the href value starts with a slash. If you just want to change the hash value, start instead with the hash character:

[ a [ href "#/page" ] [ text "Page" ]

Elm Reactor is really only useful as a lightweight debugging tool. If you are trying to link to different pages and modules within your project, then Elm Reactor is probably not a good fit. You may be better served by using your webpack live-reload functionality rather than trying to alter your code to suit a debugging environment.

Chad Gilbert
  • 36,115
  • 4
  • 89
  • 97