Eval seems to be generally regarded as a bad idea.
Is there an elegant solution to an eval on nested objects.
So my eval is
eval( "$scope" + lookup_string)
As Javascript opbjects seem to be assoiative arrays, I tried
$scope[lookup_string]
This worked fine until I got to some nested objects.
so if my string contains dots, e.g
lookup_string = "object1.object2.object3"
This works as an eval. But not as an associative_array lookup, as it is treating the string as one, not as three nested lookups.
Now I know I can split the string, and lookup each part, but this seems a fair bit work (compared to eval-ing the string).
Are there any other clean / elegant alternatives to this?