We have two or more segments and we would hide and show dynamically this segments depending on property, something like that
<ion-segment [(ngModel)]="connectionType" (ionChange)="segmentChanged($event)">
<ion-segment-button value="local" *ngIf="showFirstSegment">
First segment
</ion-segment-button>
<ion-segment-button value="local" *ngIf="showSecondSegment">
Second segment
</ion-segment-button>
<ion-segment-button value="local" *ngIf="showThirdSegment">
Third segment
</ion-segment-button>
<ion-segment-button value="local" *ngIf="showFourthSegment">
Fourth segment
</ion-segment-button>
</ion-segment>
The segment is not changing on changing properties showXXXXXSegment
, only after click on some part of the segment the segment is re rendered with the right segments shown. I also tried to use hidden
instead of ngIf