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

Feat: more generic rule to skip history API #14

Open
christophe-g opened this issue Jan 8, 2021 · 1 comment
Open

Feat: more generic rule to skip history API #14

christophe-g opened this issue Jan 8, 2021 · 1 comment

Comments

@christophe-g
Copy link

First of all, thanks a lot for this ! it is really well thought through, esp. the way to nest <router-slot>, and allow relative router (smth all other web-component friendly routing lib I had a look at fail to do properly).

The old Polymer <app-location> had a parameter to skip url from being handled by the router based on a regex.

You could for instance do <app-location route="{{route}}" url-space-regex="^(?!/api/).+"></app-location> to skip all url starting with /api.

In app-router, you'd need to add data-router-slot=disabled to all such links. It would be more convenient in some cases to rely on a more generic rule.

I can have a go at trying to add this feature if this is something you might consider adding.

The main difficulty is to find a proper way to inject this additional logic to the ensureAnchorHistory function and call it later on in the instantiation process. Maybe when the root app-router is attached ?

@jbuckner
Copy link

jbuckner commented Jan 16, 2021

I was interested in a similar use case and opened #18 which I think will do what you're looking for. It skips any anchor links not handled by the router so if you don't have a catch-all route **, it will allow the browser to handle the routing.

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