Slider tap new value


#1

Hello,

I implemented a slider in Angular TypeScript,
And I was wondering how to get the new value when the tap event is triggered on it.

<Slider [value]="currentTime" (valueChange)="onSliderValueChange($event)" (tap)="onSliderTap($event)" minValue="0" [maxValue]="duration"></Slider>
    public onSliderTap(args){
        let slider = <Slider>args.object;

        // slider -> get new value
    }

Thanks


#2

Did you try the value property of the Slider object?

https://docs.nativescript.org/api-reference/classes/ui_slider.slider#value


#3

Do you mean setting the value on tap instead of drag? That is not natively supported, you may try calculating the x axis against the width of slider for value then set same on slider.


#4

Yes, that was it.

Thank you both,