l am using ionic 4 and angular . l want to use ionic range slider . The range slider lets users to change a range of values by moving the slider . l want to change the value of setInterval to reduce refresh or increase speed of refreshing .
My code
time : 600 ;
speed = 300;
private interval;
rangeChanged(){
this.speed = 300 * this.time;
console.log(this.time)
}
play() {
this.interval = setInterval(() => {
// i deleted my code here
}, this.time);
}
The problem is , this.time
in rangeChanged
function is not getting update
. When l changing the range slider the values setInterval
are still same ! are not updating , in that case i have to stop setInterval
then start again even he get new values . My point is how can make it live updating value for setInterval
speed ?
html
<ion-range min="300" max="600" [(ngModel)]="time" color="secondary"
(ngModelChange)="rangeChanged($event)" step="10" debounce="500">
<ion-label range-left>3</ion-label>
<ion-label range-right>10</ion-label>
</ion-range>