Skip to content

Conversation

openhouse
Copy link

I want to use href-to with a component from https://github.com/miguelcobain/ember-paper that renders an anchor element.

{{#paper-button href=(href-to "settings") class="href-to"}}Settings{{/paper-button}}

I am able to use the href-to helper to set the href attribute on the component, which renders as expected. Great!

<a id="ember736" tabindex="0" href="/settings" class="href-to ember-view paper-button md-default-theme md-button md-ink-ripple">  Settings
<div class="md-ripple-container"></div></a>

But with this, href-to didn't recognize when I clicked the link. I got the hard native browser redirect rather than a nice Ember router transition. It was because every component's element gets the .ember-view class which didn't fit the conditions in href-to's initializer.

So I made this pull request to update the initializer. Now href-to recognizes and smoothly transitions clicks on anchor elements when they have the .href-to class even if they are components.

To stay out of the way, href-to continues to not intervene when there is an action set on an element.

… a route transition on click as long as the element doesn't have an ember action.
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

Successfully merging this pull request may close these issues.

1 participant