mercredi 27 septembre 2017

Having a link trigger only an action on click, but opening a different route on new tab click

I want to implement the following :

  • First, put a link.
  • When clicked, this link should trigger an action in my current route (i.e. collapsing a panel or something like that)

BUT

  • When user right clicks and selects "new tab", this same link should open a separate route (and also not trigger any action in current route because it wouldn't make sense anyway)

So far I've tried the following:

<span >
  
    Some text
  
</span>

I was hoping to override the default link-to behaviour by enclosing it in a clickable span but to no avail: now when I click on the link text, I am redirected to the new route and the click action itself never happens.

Is it possible to implement something like is using EmberJS or even plain JS tweaks?

Thanks!




Aucun commentaire:

Enregistrer un commentaire