I have been searching the web extensively to find a solution to this particular issue. I am working with a range slider and trying to set its default starting values, but so far, I haven't had any luck. I've checked both the official documentation and various online resources without success. Can anyone guide me on the correct approach? Currently, I am able to display the actual value of the range using the following code:
home.html
<ion-item>
<ion-range [(ngModel)]="rangeSettings" (ionChange)="cValue($event, 'slider1')">
<ion-icon range-left small name="water"></ion-icon>
<ion-icon range-right name="water"></ion-icon>
</ion-range>
</ion-item>
Water Flow
<ion-badge color="secondary">{{slideValueBadge[slideValueBadge.length -1]}}</ion-badge>
home.ts
import { Component } from '@angular/core';
import { NavController } from 'ionic-angular';
import * as io from 'socket.io-client';
@Component({
selector: 'page-home',
templateUrl: 'home.html'
})
export class HomePage {
socket:any
chat_input:string;
chats = [];
prova = [];
rangeSettings:any;
slideValueBadge = [];
constructor(public navCtrl: NavController) {
var a;
this.socket = io('http://localhost:3000');
this.rangeSettings = {
type: "double",
min: 0,
max: 1000,
from: 200,
to: 500
};
this.socket.on('message', (msg) => {
console.log("message", msg);
this.chats.push(msg);
});
this.socket.on('prova', (msgProva) => {
console.log("msgProva", msgProva);
this.prova.push(msgProva);
});
this.socket.on('sValue', (value) => {
this.slideValueBadge.push(value);
console.log("sliderValue:", value);
});
}
send(msg) {
if(msg != ''){
this.socket.emit('message', msg);
}
this.chat_input = '';
}
cValue(event, nome) {
console.log("SliderValue", event._valA);
this.socket.emit('sValue', event._valA);
}
}
Can someone kindly guide me on how to set the default starting position of the slider to, for example, 20?