Skip to content

Generic translate #161

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
zebslc opened this issue Oct 27, 2015 · 10 comments
Closed

Generic translate #161

zebslc opened this issue Oct 27, 2015 · 10 comments

Comments

@zebslc
Copy link

zebslc commented Oct 27, 2015

I want to use this slider in my project and have a dynamically created number of sliders.

At the moment, the translate function seems to have to be done once per slider with each function call on the state or vm.

Is there something I have missed about being able to get an id of the slider asking to make the translation or something I have missed in the documentation so I can use a more generic function? Ideally, I want to wrap this in a small additional directive to help with setting the values and styles I need.

Thanks

Jon

@ValentinH
Copy link
Member

I'm not sure to understand what you want:

  • a unique translate function for all sliders?
  • one translate function for each slider?

@zebslc
Copy link
Author

zebslc commented Oct 27, 2015

Hi there, thanks for answering so quickly! It would be one translate function for all of a given set of sliders which knows the control that is making the call. Currently I can assign a function per slider using the parameters available but that only passes into the resultant function a value element so I have to declare one function per slider. Is there a more generic way of doing this?

Regards
Jon

@ValentinH
Copy link
Member

Currently this is not possible. The fastest way for you can be to create a wrapping function for each slider which pass it the value + an ID...

I'm currently working on a refactoring (see the Readme) of this directive where I'm changing the way to pass the options. I could add something in it to handle your need.

@zebslc
Copy link
Author

zebslc commented Oct 28, 2015

That would be excellent. Just an id along with the value for translate would open up possibilities for code re-use. I did think after looking at the changes you were envisioning that it would possibly fit with that since you are aiming for more code configuration.
If you want some help with testing please let me know.

thanks

@PtrTn
Copy link

PtrTn commented Nov 2, 2015

Would it be an idea to add this to the other function callbacks (onStart, onChange and onEnd) aswell?

@ValentinH
Copy link
Member

When adding it to the translate function I actually hesitate to add them to the callbacks as well. I didn't do it but it its totally feasible if needed.

@PtrTn
Copy link

PtrTn commented Nov 2, 2015

Personally I'd love it if you could add it to the other callbacks as well. Seeing as you promote re-use I think it would be a good step for the slider in general.

@zebslc
Copy link
Author

zebslc commented Nov 2, 2015

Love the idea of an event. I took your advice in the end and wrapped in a
custom directive but an event seems a lot cleaner for centralising the code.

On Monday, 2 November 2015, Peter Ton notifications@github.com wrote:

Personally I'd love it if you could add it to the other callbacks as well.
Seeing as you promote re-use I think it would be a good step for the slider
in general.


Reply to this email directly or view it on GitHub
#161 (comment)
.


Our new children's pirate book available on iTunes -
http://tinyurl.com/5PiratesGTH

@ValentinH
Copy link
Member

Added to master.

@zebslc
Copy link
Author

zebslc commented Nov 12, 2015

Thank you :-)

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

3 participants