Example Elm application with push state navigation
This example application shows how to use push state navigation in Elm.
A server that matches any route and return the Elm application. For example when hitting /
or /users/
or /users/1
the server needs to return the same html.
In this example I'm using elm-live --pushstate
which does this automatically.
ChangeLocation String
OnLocationChange Navigation.Location
href
. This allows users to copy the link and open a page in a new tap/window.ChangeLocation "/users"
Change the browser location using Navigation.newUrl
instead of a normal link. newUrl
creates a new history entry via pushState.
See commented example.
yarn
yarn start
Open http://localhost:8000/