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

No examples of usage #131

Open
Techn1x opened this issue Aug 1, 2023 · 1 comment
Open

No examples of usage #131

Techn1x opened this issue Aug 1, 2023 · 1 comment

Comments

@Techn1x
Copy link

Techn1x commented Aug 1, 2023

The Readme shows how to install it, but no examples of usage.

How do we provide a #hash to a <LinkTo /> component? Is that even possible? (hint: we should probably make that possible)
If I use an anchor tag like <a href="/some-page#hash"> it causes a full nagivation rather than transition, so that's out as well.

The only way I've been able to get hashes to work is by using a button with a click handler, as per the code below.

<button type="button" {{on "click" this.goToTest}}>Some Page</a>
@service router

@action
goToTest() {
  const url = this.router.urlFor('my.route')
  this.router.transitionTo(`${url}#hash`)
}

(In theory you could also use an <a> tag with a click handler and event.preventDefault too.)

Is there a different way? Can we get those examples added to the readme?

@Techn1x
Copy link
Author

Techn1x commented Aug 1, 2023

I should note that <a href="#some-thing-on-same-page"> works just fine. I'm specifically referring to transitioning to another page, then applying the hash

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

1 participant