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

Switching language at runtime. #4038

Closed
crystalbyte opened this issue Dec 20, 2015 · 3 comments
Closed

Switching language at runtime. #4038

crystalbyte opened this issue Dec 20, 2015 · 3 comments

Comments

@crystalbyte
Copy link

Hey,

I am currently working on a localized single page application using angular2.
Is there a way to switch the language of select2 without reinitializing the control ?
Any help would be greatly appreciated.

Alex

@kevin-brown
Copy link
Member

Select2 does not support the ability to change options dynamically, so it is not possible to change the language without reinitializing Select2.

This is a duplicate of #2830 (comment).

@crystalbyte
Copy link
Author

Thanks, is there anything we need to take care of before reinitializing the control, any cleanup ?

@kevin-brown
Copy link
Member

You can cleanly destroy Select2 by calling select2('destroy'). You likely won't see any issues from there unless you are using the data option, which will re-create the options.

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