angular-selectize.js
angular-selectize.js copied to clipboard
onOptionSelect: dropdown options menu disappears and shows up again
When selecting an option (by clicking or using enter key) for the first time (!) after pageload, the list of all options disappears and shows up again. After selecting the desired option once again, the options disappear and from this moment everything is working fine.
This problem also occurs in the provided demo: http://plnkr.co/edit/4BuWxF
I came across this issue today in my project and found the reason behind it: when the watches initially fire on page load, both optionsUpdate
and modelUpdate
flags are set, while usually only one of them should be set at a given time. The scheduleUpdate
function should reset both flags if Selectize has not yet been initialized:
function scheduleUpdate() {
if (!selectize) {
if (!initializing) {
initSelectize();
}
// ===== Added =====
modelUpdate = optionsUpdate = false;
// ===== Added =====
return;
}