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

Problem with ion-range

$
0
0

I was making a size selector for the app text and I thought a slider might help me.

I started reading the documentation and when I finished adding the slider, I found the following problem:

Whenever y tap or change the slider value, the console logs a bunch of 0s and 1s or 2s and NaNs… Making the slider non functional…

To test this, I’m building and running in an android device.

Here’s a gif of the slider

Codes:

HTML:

<ion-content>
<ion-item>
	<ion-label [ngClass]="size">Hello World</ion-label>
</ion-item>
<ion-item>
	<ion-range min="0" max="2" step="1" knobs="true" (ionChange)="changeLetterSize(size)" [(ngModel)]="size" snaps="true"></ion-range>
</ion-item>
</ion-content>

TYPESCRIPT:

changeLetterSize(size){
	switch (size) {
		case 0:
			this.size="txpeque"
			break;
		case 1:
			this.size="txnormal"
			break;
		case 2:
			this.size="txgrande"
			break;
	}
	console.log(size); 
}

2 posts - 2 participants

Read full topic


Viewing all articles
Browse latest Browse all 48977

Trending Articles



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