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

Ion-segment issues

$
0
0

@elvis_gn wrote:

Segment content changes but segment button selection does not change

html snippet is as below

<ion-segment [(ngModel)]="segment" ion-text color="primary">
	<ion-segment-button value="login">Log In</ion-segment-button>
 	<ion-segment-button value="signup" ion-text color="primary">Sign Up</ion-segment-button>
</ion-segment>

<div [ngSwitch]="segment">
       <ion-list *ngSwitchCase="'login'">
            <someTags>
       </ion-list>
       <ion-list *ngSwitchCase="'signup'">
            <someTags>
       </ion-list>
</div>

On successfully creating a user, I popup an alert and would like to switch the segment to the 'login'. I do the following:

this.signUp(this.registerForm.get('username').value, this.registerForm.get('password').value)
			.then(result => {
				if (result.signup) {
					console.log('LoginPage :: onSignup : Switch to Login');
					this.registerForm.reset();
					this.segment = 'login';
					this.cd.detectChanges();
				} else {
					console.log('LoginPage :: onSignup : Remain on SignUp');
					this.segment = 'signup';
					this.cd.detectChanges();
				}
			});

I find that the signup form gets cleared and the ion-list switches to that of the login...BUT the segment button selection remains on the signup...

Any ideas ?

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 49240

Trending Articles