-
Notifications
You must be signed in to change notification settings - Fork 10
w11k-select-options with object as the selected model? #17
Comments
Hello Andreas, what do you mean by
did you do the following? Or what exactly did you try? w11k-select-options="book as book.label for book in widget.bookSet"
ng-model="widget.selectedBooks" You should be able to push the whole book-Object into your selectedBooks-Array by using the Syntax mentioned above. Greetings |
Yes I tried this, and it didn't work. The only one that worked was:
but nothing was selected by default (Which is the behaviour that I want) |
actually no -
If I instead have |
Hi Andreas, You're right, there are hash collisions. I created a jsbin to reproduce the bug: http://jsbin.com/cuzanifoqo/1/edit?js,output With 1, 2, 3 and 4 as values it does not work. But it works with 11, 22, 33, and 44 as values with unchanged labels. I created another jsbin to test the hash function: http://jsbin.com/wokifobovu/1/edit?js,output |
Hi @amarkitanis , If you're using w11k-select and like it, please think about giving an 'I use it' at ngmodules.org Thanks & regards, |
Hi,
While this works fine:
I want to be able to reference the actual book object in my widget.selectedBooks model.
An issue I have found is that I have cases where my bookSet array has objects where the book.value is the same (i.e not unique) and this creates problem with option.hash - therefore not displaying the actual dropdown because of ng-repeat dupes.
So rather than have an array of strings in selectedBooks, I want to have an array of objects. This would solve the issue of the ng-repeat problem with the option.hash track by and also cases whereby I want to deal with the whole object in my model and not just the string value.
When I try that, I don't see anything in the dropdown. Do I need to change something?
Thanks,
Andreas
The text was updated successfully, but these errors were encountered: