I have a JSON obj. as below:
[
{"Title":"x", "Type":"y", "Desc":"First Description"},
{"Title":"r", "Type":"q", "Desc":"Second Description"}
]
I want to have a drop-down including Titles in this obj (using ng-options
). Then, I want to use the the Index of selected Title in the object. (Imagine the object will be used as array (called myArray), as what user194715 answered here)
for example:
var type = myArray[selectedIndex].Type;
var description= myArray[selectedIndex].Desc;
How can I access to the index in this case?