Updating tab badge programatically

I must have missed something, but here goes:

How can I programatically update a tab’s badge (hide, show, change content)?

Thanks!

If the badge is based on data from json, you can just use an ng-if to hide it if no data is there.

 <span ng-if="item.badge" class="badge badge-assertive">{{item.badge}}</span>
1 Like

Hi Mike,

Your answer is not relate to tab. Can you please tell me how can a badge in tab be hidden programatically/dynamically when count is zero? I’m using Ionic framework 1.x

Your help would be greatly appreciated.

Thanks in advance.

<ion-tab title="test" icon-on="someongfx" icon-off="someoffgfx" badge="yourbadgecountvariable" badge-style="badge-energized" ui-sref="your.route">
    <ion-nav-view>
    </ion-nav-view>
</ion-tab>

Thanks! That worked for me!

1 Like