I need to add a number badge to the cart icon in ionic 3 so that the user gets the update of number of elements in the cart without actually visiting the page i tried to use the code of button and badge together but it was of no use
<button ion-button icon-only (click)="cart()">
<ion-icon name="cart"> <ion-badge item-end>260k</ion-badge></ion-icon>
</button>
Above code displays the badge next to the cart icon but not over it, so is there a way to add badge to the icon itself like we have in notification alert badges?
Try this one
Template:
CSS:
I think you will have to use some CSS and absolute positioning to place the badge above the left corner of the cart icon.
Something like this:
CSS