Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Accessing selected value instead of selected index #208

Open
kamilchlebek opened this issue Jun 3, 2019 · 2 comments
Open

Accessing selected value instead of selected index #208

kamilchlebek opened this issue Jun 3, 2019 · 2 comments

Comments

@kamilchlebek
Copy link

I'm using DropDown in angular application. I've successfully provided values using ValueList. Then I've created ReactiveForm and attached formControlName to DropDown component. Unfortunately form is updated with selected index instead of selected value.

I've seen few tasks regarding this issue. Nevertheless maybe it would be good to provide users with some configuration to change that behavior? Some libraries provide bindLabel and bindValue options.

It's especially inconvenient when you provide items using async pipe: [items]="items$ | async, because to fetch selected value you have to create another combination of Observables and operators to fetch value for given index.

@PeterStaev
Copy link
Owner

Hey @kamilchlebek , thank you for the suggestion. Sadly for the time being I do not plan on adding this. If you look at the ListPicker widget from NativeScript it follows the same concept. If you want the value you can simply handle the selectedIndexChanged and update your value. Or if you need it only for save, you can pull the value by its index before sending the data to your backend.

@kamilchlebek
Copy link
Author

Thanks for your response. I handle it on my side. I just wanted to share the suggestion with you :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants