Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 71531

How to set the selected Segment

$
0
0

@shmu80 wrote:

I am using ion-segment in my page, and I want to set one of the segment is selected segment whenever the page show, but it is not working if I use ngSelected="selected".

Anybody can advise how to set the selected segment as default segment whenever the page display?

Code:

<div>
  <ion-segment [(ngModel)]="testing">
    <ion-segment-button value="book">book</ion-segment-button>
    <ion-segment-button value="table">table</ion-segment-button>
  </ion-segment>
</div>
  <div [ngSwitch]="testing" >
    <ion-list *ngSwitchWhen="'book'" ngSelected="selected">
      <a ion-item>
        <ion-label>book list</ion-label>
      </a>
   </ion-list>
<ion-list *ngSwitchWhen="'table'">
      <a ion-item>
        <ion-label>table list</ion-label>
      </a>
   </ion-list>
</div>

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 71531

Trending Articles



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