In my Angular application, I am receiving an object with multiple arrays from a REST service.
I need to access the value from the incoming object based on the property name.
Here is what the object looks like:
data{
array1:{},
array2:{},
array3:{}
}
The number of arrays and their names can vary. I have another array containing all these array names like...
arraynames = {array1,array2,array3}
I have attempted to retrieve the value using...
data[arraynames[0]]
or
data[0]
or
data[array1]
However, none of these methods seem to be working as they are returning undefined.
Is there a way for me to successfully retrieve the value of an array from data?