-
Notifications
You must be signed in to change notification settings - Fork 113
All options are treated as user options #69
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
Comments
- Fix machineboy2045#69 - Use registerOption instead of addOption, like Selectize does on initialization
I have made a fix for this issue, it is in my fork, but to make a clean pull request, it seems the previous pull request must be merged. |
I don't see how this distinction can be made by the wrapper. How does it know which options in $scope.options are from the user? If $scope.options becomes [] I think the wrapper should delete all options. |
The wrapper doesn't need to make a distinction. It adds all options in $scope.options via registerOptions, and lets Selectize to add user options via its own addOption, ie. as user options. Ie. the former are "native" options (eg. coming from the server, or hard-coded) and the latter are really the new ones entered manually. |
Honestly, this behavior is very annoying. I have another case where I really want to distinguish original options from typed ones! |
Or programmatically changed options. Fixes issue machineboy2045#69. Also fixes machineboy2045#110... Demo at http://plnkr.co/edit/2352rt
This wrapper takes either the value of the
options
attribute, or theoptions
configuration (or the ngModel options otherwise) and adds them to Selectize via theaddOption()
API.This is not a good behavior: Selectize itself treats the
options
configuration in a special way, usingregisterOption()
instead, so these are base options that cannot be deleted.Only the options really added by the user can be deleted, the others are just unselected and added back to the option list.
angular-selectize should use
registerOption()
too to initialize the component.The text was updated successfully, but these errors were encountered: