[go: nahoru, domu]

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get/ Set value from/ to query string #5

Closed
amitaibu opened this issue Oct 15, 2015 · 8 comments
Closed

Get/ Set value from/ to query string #5

amitaibu opened this issue Oct 15, 2015 · 8 comments

Comments

@amitaibu
Copy link
Collaborator

Sometimes it makes more sense to have query strings mapped to the actions instead of actual arguments (e.g. when filtering search using faceted search)

@amitaibu amitaibu changed the title Getting value from query string Get/ Set value from/ to query string Nov 21, 2015
@amitaibu
Copy link
Collaborator Author

(updated title)

@rgrempel
Copy link
Owner

I took a quick look at this, and it turns out that it will be a little more complex than I realized.

At the moment, elm-history provides access to window.location.pathname and window.location.hash, but not window.location.search. So, given a URL like:

http://www.apple.com/some/path?query=7#anchor

... elm-history will give us access to "/some/path" and "#anchor", but nothing else.

If elm/package.elm-lang.org#124 gets accepted, then I can enhance elm-history so that it provides access to window.location.search etc. Otherwise, we won't be able to do it without using native code here.

@amitaibu
Copy link
Collaborator Author

ping. Are you still in elm-land ? :)

@rgrempel
Copy link
Owner
rgrempel commented Apr 7, 2016

Ah, indeed, here I am!

I have been a little distracted, but there has been progress in elm-history, as @liamcurry has contributed some code to get the full href in a signal.

Though, now that I think about it some more, we'll actually need some code to set the full href as well, or at least as much of it as the HTML5 API allows. But that isn't hard -- I'll write something up for that now.

Once that's done, I need to re-architect elm-route-hash a little so that the current method of parsing is just one option -- so people can get and set full URLs.

@rgrempel
Copy link
Owner
rgrempel commented Apr 7, 2016

I'm not sure what I was thinking ... the History module will already allow us to write the query string via setPath or replacePath. So, that's all in place ... I just need to modify elm-route-hash to use it.

@amitaibu
Copy link
Collaborator Author
amitaibu commented Apr 8, 2016

👍

@rgrempel
Copy link
Owner
rgrempel commented Jun 4, 2016

This will be implemented for elm-route-hash 2.0, for Elm 0.17.

@rgrempel
Copy link
Owner

This is now available in the published version 2.0.0 of elm-route-url.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants