Reputation: 1851
I would like to show some pending books in a tab. I want to show a number in ionic tab icon. It is possible?
Like this image.
<ion-tabs class="tabs-striped tabs-dark tabs-background-positive">
<ion-tab title="Fila" icon-off="ion-ios-people dark" icon-on="ion-ios-people" href="#/tab/queue">
<ion-nav-view name="tab-queue"></ion-nav-view>
</ion-tab>
<ion-tab title="Comissões" icon-off="ion-social-usd-outline dark" icon-on="ion-social-usd-outline" href="#/tab/profit">
<ion-nav-view name="tab-profit"></ion-nav-view>
</ion-tab>
<ion-tab title="Agenda" icon-off="ion-ios-calendar-outline dark" icon-on="ion-ios-calendar-outline" href="#/tab/book">
<span><number here ??></span>
<ion-nav-view name="tab-book"></ion-nav-view>
</ion-tab>
<ion-tab title="Perfil" icon-off="ion-android-person dark" icon-on="ion-android-person" href="#/tab/profile">
<ion-nav-view name="tab-profile"></ion-nav-view>
</ion-tab>
</ion-tabs>
Upvotes: 0
Views: 902
Reputation: 1851
I found the solution. Just use badge Attr. Thanks
http://ionicframework.com/docs/api/directive/ionTab/
Upvotes: 2
Reputation: 5135
Make your container be position:relative
then add position:absolute
to the number container ( it could be a p, span, div tag, anything, doesn't matter).
Then you can change the top
, left
, right
and bottom
property for the number container to position it how you want it.
ion-tab{
position:relative;
width: 50px;
height: 50px;
border: 1px solid black;
}
ion-tab span {
position: absolute;
top: 0;
right: 0;
}
<ion-tab>
<span>10 </span>
</ion-tab>
Make sure you add that span tag inside the ion-tab that you want the number to be in.
Upvotes: 1