angular-selectize.js icon indicating copy to clipboard operation
angular-selectize.js copied to clipboard

Model not initializing correctly in some scenarios

Open stgeorge opened this issue 12 years ago • 3 comments

I ran into an issue where angular was populating the options and triggering a model update as well, which then went into scheduleUpdate, and the first time it initializes but eats the request that sent it there in the first place. I was using multiple select boxes with dynamically generated dropdown contents (using filtered expression) so not sure if that's related.

So I removed the:

modelUpdate = optionsUpdate = false;
return;

To allow it to fall through and process the request after initializing and that seemed to work but I'm not sure what the original purpose this check was trying to fix.

stgeorge avatar Aug 19 '14 05:08 stgeorge

scheduleUpdate skips the model update if the selectize component is still initializing to avoid the selectize object being in an unknown state. Perhaps avoiding one timing issue has caused another.

Does it solve your scenario if we remove the modelUpdate = optionsUpdate = false; line and just return?

EvanOxfeld avatar Aug 20 '14 01:08 EvanOxfeld

I tried it with just the return and it seems to function correctly in my app (using single selection mode).

stgeorge avatar Aug 20 '14 03:08 stgeorge

In 1.4.3 the directive doesn't reset the modelUpdate and optionsUpdate flags if selectize is uninitialized.

I think this issue is resolved, but if you run into problems again we can reopen it.

EvanOxfeld avatar Sep 19 '14 14:09 EvanOxfeld