Polymer paper-card link

I want to make paper-card whole element as a link. How to do it properly? I've tried in this link: http://pastebin.com/Ch453kvK. Is that the proper way to do it? Actually it change styling that I applied to it.

Upvotes: 0

Views: 468

Answers (1)

Supersharp
Supersharp

Reputation: 31171

There are several ways to acheive this:

1. You solution is correct if it works. You can also try to put the <a> tag inside the <paper-card> element.

2. Or you can catch the click event on the <paper-card>, set the location.href property.

document.querySelector( 'paper-card' ).addEventListener( 'click', function ()
{
    location.href= '#link'
} )

3. Or you can put all the content of the <paper-card> in a <button>, or in a <paper-button> and set the location.href property in the onclick handler.

4. As suggested by @Adamos42 you can use Polymer events.

Upvotes: 1

Related Questions