router
router copied to clipboard
is it possible to treat `#` as a normal character (and not a "hash" prefix) on a route
Hello,
Have been using vaadin router in all my recent projects, and pretty happy with it, thanks!
Today, I fail to figure if it is possible to treat the # character (located as the first character of a route parameter), as a character, instead of the hash prefix.
In my use case, i'd like to find the id route param, from all routes after / starting with # or @ (i'm trying to map matrix/element room & user id, which have these two characters as prefix).
Links:
- test: https://codesandbox.io/s/dreamy-fog-ej95q4?file=/index.html:525-582
- docs: https://vaadin.github.io/router/vaadin-router/demo/#vaadin-router-route-parameters-demos
- path detection uses the npm lib: https://github.com/pillarjs/path-to-regexp#parameters
test 1
{path: '/:id', component: 'page-profile'}
It works if id starts with @, but not with #
test 2
{path: '/profile/#:room_id', component: 'page-profile'} # is not getting triggered, even if `#` is escaped in a regex query
{path: '/profile/@:user_id', component: 'page-profile'} # is getting triggered correctly
expected result
- in the case example.com/profile/#matrix:matrix.org where room id is
#matrix:matrix.org, the route paramid, would have the values#matrix:matrix.orgor in the case example.com/profile/@test-user:matrix.org, where a user id is@test-user:matrix.org, the route paramuser_idwould have the value@test-user:matrix.org