-
Notifications
You must be signed in to change notification settings - Fork 1.8k
ui-select modifying ng-model object #540
Comments
My only thought is that it would relate to the changes to |
I went into the dist folder and downloaded |
You'll need to post an example of it not working correctly via something like http://plnkr.co |
http://plnkr.co/edit/sJEQrTeEgDUs8Ca0sdne?p=preview has a demo, but ui-select is either broken or plunker is broken because there are errors in the console that I don't see in my project. I double checked my code and I'm almost positive I'm not modifying the variable after the controller instantiates, is there anything else you can think of? |
I got the same issue here. ui-select installed via bower. I found that problem occurs when the model contains objects different from the ui-select-choices source. I.e. when editingDesk.users == [$users[0],$users[1]], it will work, but if editingDesk.users == [user1, user2] - it will clear editingDesk.users (assuming user1 and user2 are of the same type as $users[0], of course). Here is plunker demo: http://plnkr.co/edit/62RgP0cLCsbqWl9QBurc?p=preview . Uncomment last lines in demo.js to see the difference. |
@brianfeister any thoughts on how we can fix this? |
hello I used this and its working now, here is an example http://plnkr.co/edit/NJ21xltT1ABCgWmhuaDo?p=preview |
@b3n0n - thank you! Sorry to everyone else, I just haven't had the time to look into this. Does @b3n0n's code help? |
@brianfeister Not sure if I'm putting in the wrong place or @b3n0n is using an old version, but with the latest select.js from the dist folder and his change made, it doesn't seem to fix the issue. |
It seems to work only for static lists, I was trying to do this but still no luck 😄 |
Yeah this needs a proper solution @brianfeister. Take a look at #410 or #405 and a few others. |
Thanks for helping this along @ilanbiala and @b3n0n. I've implemented the change advised in the referenced PR's #410 & #405 in this plunkr. Unfortunately, it doesn't fix the issue. The code has moved alot since the PR's were opened, sorry to say. I'm watching this thread - if someone were to make the Plunkr work and post a code snippet, I could get a fix committed and merge it but I'm under an extreme deadline for a few weeks at work so I'll be unlikely to debug it myself during that window. |
@brianfeister could it be because i'm using an ES6 Set? |
That could definitely be the cause, I doubt |
@brianfeister I switched to an array, and I still have this issue. Can you take a look to see what the issue is, because now I'm just using regular javascript. |
There are cases where it does not make sense to check the values in the ng-model against the ui-select-choices as described in #405 . |
so it could be a toggle for this verification? @brianfeister @Asimov4 ? |
@brianfeister this seems like it could be prevented by what @Asimov4 is saying. Any thoughts? |
Motivation: Fix angular-ui#540 The tagging mode is designed to allow new values to be added to the model. It does not make sense to check those values against the list of choices when going from model --> view.
I suggested a pull request to not check values if the tagging mode is enabled. Here is a plunker where this change is in: http://plnkr.co/edit/XeUwyQV0nTHaQmgg4Sc4?p=preview |
Motivation: Fix angular-ui#540 The tagging mode is designed to allow new values to be added to the model. It does not make sense to check those values against the list of choices when going from model --> view.
Motivation: Fix angular-ui#540 The tagging mode is designed to allow new values to be added to the model. It does not make sense to check those values against the list of choices when going from model --> view.
Motivation: Fix angular-ui#540 The tagging mode is designed to allow new values to be added to the model. It does not make sense to check those values against the list of choices when going from model --> view.
Motivation: Fix angular-ui#540 The tagging mode is designed to allow new values to be added to the model. It does not make sense to check those values against the list of choices when going from model --> view.
@ilanbiala are you still having issues with this? I'm putting together some changes at #748 that might be related |
I reworked my implementation to hack around it after having some issues. |
Motivation: Fix angular-ui#540 The tagging mode is designed to allow new values to be added to the model. It does not make sense to check those values against the list of choices when going from model --> view.
Motivation: Fix angular-ui#540 The tagging mode is designed to allow new values to be added to the model. It does not make sense to check those values against the list of choices when going from model --> view.
Motivation: Fix angular-ui#540 The tagging mode is designed to allow new values to be added to the model. It does not make sense to check those values against the list of choices when going from model --> view. Conflicts: src/uiSelectMultipleDirective.js
Is this still currently an issue? Can someone post a reproduction in Plunker based off of the latest release? |
With this snippet:
When the controller instantiates,
editingDesk.users
is properly populated. Once the controller finishes instantiating,editingDesk.users.length
is 0. If I comment out the HTML above, then I don't have this issue.The text was updated successfully, but these errors were encountered: