Skip to content

when using stepsArray you cannot use the translate function #177

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

Closed
kevohagan opened this issue Nov 17, 2015 · 5 comments
Closed

when using stepsArray you cannot use the translate function #177

kevohagan opened this issue Nov 17, 2015 · 5 comments

Comments

@kevohagan
Copy link

this can be seen here: https://github.com/rzajac/angularjs-slider/blob/master/src/rzslider.js#L368

shouldnt this be an improvement?

:)

@ValentinH
Copy link
Member

Indeed, I couln't find a use case where I needed both stepsArray and translate. I discussed it in #163 .

StepsArray values should already be translated.

If you have a use case in mind that need both features, please share it. :)

@kevohagan
Copy link
Author

Well i guess its quite obvious, same use case as using translate in the first place.

for example a list of of numerical values that i want to display with a currency symbol. I dont think the steparray values should already have that currency symbol no?

maybe im missing something

@ValentinH
Copy link
Member

I'm actually using the stepsArray to display money and I directly add the symbol in the stepsArray values. It is more efficient since you don't need to recompute them at runtime.

@ValentinH
Copy link
Member

In my opinion, a translate function would be necessary if the steps values change while the slider is dragged. Otherwise, you only need to update the stepsArray.

For the currency example, I would do:

vm.values = [1, 10, 100, 1000];
vm.sliderConfig = {
  stepsArray: vm.values.map(function (v) {
      return '$' + v;
  })
};
}

http://jsfiddle.net/sLdvup1t/

@ValentinH
Copy link
Member

Closing as no answer for more than a week

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

No branches or pull requests

2 participants