Access tab badge from Tab


#1

Hello,

How do I change the tab badge from inside a Tab (ion-tab)? I have a list of questions in a Tab and would like to show a badge to indicate unanswered items. I can access the badge from the Tabs container but the container has no knowledge of the data that’s inside the Tab.

Regards,
Kid


#2

you need to bind directive.

In tabs.ts, you need to declare a variable

public myValue = 0; //any number

and in tabs.html, you need to bind it like this

[tabBadge]="myValue"


#3

This works only for the first time when app starts. Every time when you click on tab if the myValue had changed,
then you cannot use this.