I have array of object which contains number of scope variable name in it. All the scope variable value has already been set before.
Something like this :
$scope.myarray = [{'id':'myname1'},{'id':'myname2'}];
$scope.myname1 = 'John';
$scope.myname2 = 'Rick';
Now if I want to get value of the scope variable which within the 'id' of 'myarray',what should I do?
I have already tried this
var getMeMyValue = $scope[myarray[0]];
Something like this,but it didnt help.
I have seen in this example that how to set scope variable dynamically
But I didnt get anything about how to get value dynamically
Please help me with this,Thanks!!
P.S. Here I'm dynamically getting my scope variable so there is no way that I can access them directly to get their value