Improving upon sebaferreras' answer.
Start by including a slider with (ionChange) and ensure the min/max values align with your custom steps [1,5,7,20] = 0-3. You can also dynamically calculate the array length.
The {{customSteps}} will display your customized values
The HTML:
<ion-navbar>
<ion-title>
Slider with uneven steps
</ion-title>
</ion-navbar>
<ion-content>
<ion-badge item-right>{{customSteps}}</ion-badge>
<ion-range
min="0"
max="3"
[(ngModel)]="slider"
(ionChange)="watchSlider()"
snaps="true">
</ion-range>
</ion-content>
Your watch function will convert the slider values to your custom values. Note that the custom steps array must have the same length as your slider in order to dynamically match numbers.
The code:
import {Component} from '@angular/core';
@Component({
templateUrl:"home.html",
})
export class HomePage {
slider: any = 1; //Holding the current slider values
customSteps: any; //Storing the custom values
constructor() {
this.watchSlider(); //initializing the slider
}
watchSlider(){
//Converting slider steps to custom values
const steps = [1, 5, 7, 20];
this.customSteps = steps[this.slider];
}
}
Plunker Link