ngx-slider - config step is 50 and can dynamic value

947 Views Asked by At

I'm using ngx-slider in angular9, and config like this:

     options = {
            floor: 0,
            ceil: 1000,
            step: 50,
            hideLimitLabels: true,
            translate: (value: number): string => {
                return '$' + value;
            }
      }
      value = 46;

<ngx-slider [(value)]="value" [options]="options" (userChangeEnd)="onUserChangeEnd()"></ngx-slider>

And the slider will show at $50 point the first time.
I want it will show at the $46 point base on the value.
How can I do that?

enter image description here

1

There are 1 best solutions below

0
On

Did you try floor value as 46

options = {
        floor: 46,
        ceil: 1000,
        step: 50,
        hideLimitLabels: true,
        translate: (value: number): string => {
            return '$' + value;
        }
  }