Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't translate labels when combined. #319

Open
tstephansen opened this issue Apr 6, 2022 · 1 comment
Open

Don't translate labels when combined. #319

tstephansen opened this issue Apr 6, 2022 · 1 comment

Comments

@tstephansen
Copy link

Is there a way to not translate the labels when they are combined?

For example, I want the slider to have a % sign after the min and max values but when they are combined I only want a % sign after the max value.

image

image

@Tessmore
Copy link

Tessmore commented Apr 23, 2022

@tstephansen You can provide an option: https://github.com/angular-slider/ngx-slider/blob/master/src/ngx-slider/lib/options.ts#L90

  /** Custom function for combining overlapping labels in range slider.
      It takes the min and max values (already translated with translate fuction)
      and should return how these two values should be combined.
      If not provided, the default function will join the two values with
      ' - ' as separator. */
  combineLabels?: CombineLabelsFunction = null;

In your case, something like (untested)

    sliderOptions: Options = {
        floor: floor,
        ceil: ceil,
        combineLabels = (min, max) => { return minValue.replace("%", "") + " - " + maxValue }
    };

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants