I'm attempting to prevent a scenario where clicking the child event does not trigger the parent event.
Here is my code:
<div class="card">
<div class="item item-divider">Choose 3 favorite players</div>
<ion-item class="item-button-right" ng-repeat="player in dataService.playerlist" item="item" ng-href="#/tab/chat">{{player.name}}
<div class="buttons">
<button class="button button-assertive icon ion-android-favorite" ng-click="addToFavorite(player)"></button>
</div>
</ion-item>
</div>
Here's the actual situation: http://codepen.io/harked/pen/WvJQWp
What I aim to achieve is the following: Clicking on an item (player) should redirect to the 'Player Detail page'. However, clicking the favorite button should only display an alert and add the player to favorites without redirecting to the 'Player Detail page'.
I have already tried adding item.stopPropagation();
or event.stopPropagation();
but it didn't work.
Any suggestions? Your help would be highly appreciated.