Switch segment on validation


#1

Hi I have a segment control with 2 sections, I want the user to enter their information on step 1 before they can go to step 2. Below is what I have, But when step 2 is selected, it does the validation, but it still switches over to step 2, I want it to stop, It must only go to Step 2 when the validation passes.

	<ion-segment [(ngModel)]="section">
  <ion-segment-button value="client">
    Step 1
  </ion-segment-button>
  <ion-segment-button value="products" (ionSelect)="ValidateStep1()">
    Step 2
  </ion-segment-button>
</ion-segment>

Any ideas?

Thanks in advance.


#2

I’m having the same issue. That’s seem not so many ionic team guys here for support. So i have to workaround like this one

  • ionSelect method, turn on a flag
  • ionChange, if flag is turned on => you call ionSelect to the last one.

Hope to get supports form Ionic team.


#3

Hey,

I am stuck with the same problem. @datpt154, could you explain more precisely what’s your workaround ?
Thanks.