mardi 2 février 2016

How to stop the inner action from bubbling to the outer link-to helper?

When clicking the "edit" to trigger the action "edit":

  {{#link-to "pages.show" page class="list-group-item"}}
    {{page.name}}
    <span class="badge" {{action "edit" page preventDefault=false}}>edit</span>
  {{/link-to}}

Then the action is triggered (e.g. the edit page is opened), but in the next second the link-to redirect is done so I end up on the "pages.show" route.

Expected: Solely the action "edit" is invoked and the click event(?) is not "bubbled" to the link-to helper.

Side notes Ember 2.2 is used and the template above is part of a component.

PS: I red that using preventDefault=false inside an action would stop this type of behavior - but obviously the link-to helper gets the information from somewhere else.




Aucun commentaire:

Enregistrer un commentaire