iron-location
iron-location copied to clipboard
<iron-location> should not disassemble the url
Hi,
I propose to let <iron-location>
just sync to the url bar, not split the url string. The splitting should be done by another element.
<iron-location url="{{url}}"></iron-location>
<iron-url-splitter url="{{url}}"
use-hash-routing
path="{{path}}"
query="{{query}}"></iron-url-splitter>
<iron-query-params params-string="{{query}}"
params-object="{{queryParams}}">
Note: <iron-url-splitter>
is ATM purely fictional. I just use it to show how it would look like.
PROs:
- Separation of concerns:
<iron-location>
is responsible for syncing to the url bar only - Atomic updates: Just one string parameter for everything
- The disassembly for hash routing could be done properly. The element that does the splitting (here my fictional
<iron-url-splitter>
) should care about hash routing vs path routing.- Currently it ends up like this:
?key=value#/my/path
(Note the reverse order) - It should look like this:
#/my/path?key=value
- Currently it ends up like this: