I fixed it. (note i used a plugin for icons so these should usually not work for you if you don't have them installed in your app):
<i primary range-left class="fa fa-bicycle"></i>
<i primary range-right class="fa fa-train"></i>
HTML:
<ion-list-header>
<ion-badge item-right>{{ trainvalue }}</ion-badge>
</ion-list-header>
<ion-item>
<ion-range min="0" max="400" pin="false" step="100" snaps="true" [(ngModel)]="train" color="primary" (ngModelChange)="onChangeTrain($event)">
<i primary range-left class="fa fa-bicycle"></i>
<i primary range-right class="fa fa-train"></i>
</ion-range>
</ion-item>
TS:
export class MyFancyClass {
train = 200;
trainvalue: any;
textChangeTrain: any;
}
constructor(public navCtrl: NavController, public navParams: NavParams) {
this.textChangeTrain = ["Not Important", "Not that Important", "Neutral", "Important", "Very Important"];
this.trainvalue = this.textChangeTrain[2];
}
onChangeTrain() {
if (this.train == 0) { this.trainvalue = this.textChangeTrain[0] }
if (this.train == 100) { this.trainvalue = this.textChangeTrain[1] }
if (this.train == 200) { this.trainvalue = this.textChangeTrain[2] }
if (this.train == 300) { this.trainvalue = this.textChangeTrain[3] }
if (this.train == 400) { this.trainvalue = this.textChangeTrain[4] }
}
How it works:
This checks if the Range is being used.
(ngModelChange)="onChangeTrain($event)"
This is the function of it.
If the Range is on the value "0" then we call this.trainvalue from the {{trainvalue}} it will check the array for the correct number and replaces it with text.
onChangeTrain() {
if (this.train == 0) { this.trainvalue = this.textChangeTrain[0] }
This is used to declare our values. train = 200; sets the Range to default 200 value, trainvalue:any; gives us the ability to do anything with this value same with textChangeTrain: any;
train = 200;
trainvalue: any;
textChangeTrain: any;
Here we are adding the Array and setting the trainvalue to [2] wich means we set it to 200 but we write [2] because we are calling it from the array.
this.textChangeTrain = ["Not Important", "Not that Important", "Neutral", "Important", "Very Important"];
this.trainvalue = this.textChangeTrain[2];
}
I hope this will help someone in the future, happy coding.