Bypass <app-route> to make normal links work in Polymer 2

379 Views Asked by At

My site uses Polymer 2, <app-location> and <app-route>. The <app-route> allows me to change the URL on user interaction with the app, but it seems that it is also preventing normal links from functioning.

How can I make normal <a href="/some/url/on/my/domain"> links work? Is there a way to make links bypass <app-route>?

2

There are 2 best solutions below

0
Magnus On BEST ANSWER

Couldn't get the answer by user2438933 to work, but this seems to do the trick!

<a href="/some/url" onclick="normalLinkClick(event)">
...
normalLinkClick(event){
  event.stopPropagation()
}
2
User 28 On

The app-location use iron-location which listen click event on document. So just stop click event before it propagates to document.

<a href='/some/url' on-click='stopPropagation'>
...
stopPropagation (event) {
  event.stopPropagation()
}