mardi 6 octobre 2015

Ember: tab component with refresh button

I have a tab component (similar to Bootstrap's tabs) in Ember, where every tab can be clickable but also has a refresh button next to the label. The problem I have is that whenever I click the refresh button to trigger the refresh action the switchTab action to open the tab is also triggered, because they are nested. Since the actions don't know anything about each other, how do you trigger the correct action (or cancel the incorrect one?)

<li class="tab" {{action 'switchTab' tab}}>
    <span {{action 'refresh' tab}}>Refresh&nbsp;</span>
    Bubble Bobble Tab
</li>

One option is to separate the label into its own span and put the switchTab on that element, but that would mean that only the label was clickable (without a lot more css), which is a bad user experience.




Aucun commentaire:

Enregistrer un commentaire