indrimuska / angular-selector

A native AngularJS directive that transform a simple <select> box into a full html select with typeahead.
http://indrimuska.github.io/angular-selector
MIT License
96 stars 36 forks source link

"model" is not cleared if items in "options" removed and options array isn't re-created. #30

Closed C00per closed 8 years ago

C00per commented 8 years ago

Hi! The Model property cleared well when I remove the item from options, and there are other properties. But it is not cleared if there was only one item in "options" and it was removed.

indrimuska commented 8 years ago

Hi @C00per, I am not able to reproduce that issue, this is the plunker I've just created. Could you please provide me a valid example showing your problem? Thanks

C00per commented 8 years ago

Hi @indrimuska, Please see the pluker. The problem as I can see that we use splice() in different ways.

C00per commented 8 years ago

So it works only when a copy of array is created plunker

indrimuska commented 8 years ago

OK, you're right, options array must be deeply $watched from the inside. I'll fix it in a minute.

indrimuska commented 8 years ago

$watchCollection should work fine, let me know if you have any troubles with this issue yet. :)

C00per commented 8 years ago

@indrimuska, thank you! v1.3.2. works fine!