Hop is meant to be used with the Elm Navigation package.
On top of Elm Navigation Hop provides:
- Matchers for URL parsing
- Support for nested routes
- A helper for reverse routing
- Transparent support for push or hash routing
- Helpers for changing the query string
Please see this example app. It explains how to wire everything in the comments.
A proper url should have the query before the hash e.g. ?keyword=Ja#/users/1
,
but when using hash routing, query parameters are appended after the hash path e.g. #/users/1?keyword=Ja
.
This is done for aesthetics and so the router is fully controlled by the hash fragment.
See examples/basic
and examples/full
folders. To run the example apps:
- Clone this repo
- Go to example folder
- Follow the readme in that folder
Thanks to @etaque and @Bogdanp for the inspiration to make this better.