Closed erkanarslan closed 6 years ago
Hey @erkanarslan , this is because the DropDown does not enforce the use of ValueList
. It can be bound to either a simple array or an ObservableArray
and there is no value there. Moreover this is how it works in plain Nativescript. So this will not be changed and you will have to work with the index to get the value and populate it in your model.
@PeterStaev It doesn't matter what kind of list you use. You can use the value inside simple array or ObservableArray for ngModel like how you do in web development with select
element.
@erkanarslan that is true but in the NativeScript ecosystem everything is based on indexes. For example the ListPicker functions similarly.
This is just a suggestion.
ngModel watches the index of the item. Because of that, when user selects a value we need to listen to index change event and get that item by its index. A better solution would be directly watching the value. That way, we don't have to listen to change event, find the item and assign it to the variable.