Quantcast
Channel: Ionic Framework - Ionic Forum
Viewing all articles
Browse latest Browse all 48983

Ion-segment doesn't change my content

$
0
0

Hello everyone,
ionic v6
angular v11

I have this code:

<ion-content>
  <ion-segment (ionChange)="segmentChanged($event)" value="list">
    <ion-segment-button value="list">
      <ion-label>
        List
      </ion-label>
    </ion-segment-button>
    <ion-segment-button value="card">
      <ion-label>
        Card
      </ion-label>
    </ion-segment-button>
  </ion-segment>
  <ion-list class="animate__animated animate__slideInUp animate__fast" *ngIf="segment === 'list'">
    <ion-item *ngFor="let item of arr; let index = index">
      <ion-label>Item {{ index + 1 }}</ion-label>
    </ion-item>
  </ion-list>
  <div class="animate__animated animate__slideInUp animate__fast" *ngIf="segment === 'card'">
    <ion-card *ngFor="let item of arr; let index = index">
      <ion-card-content>
        <h2>Card {{ index + 1 }}</h2>
      </ion-card-content>
    </ion-card>
  </div>
</ion-content>

When I emulate this code on android studio, and I change my current segment to another one, nothing happened…
My content does’nt change.

DO you know why?

1 post - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 48983

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>