I have the following function
$scope.makeBasic = function (item, node1, node2, node3) {
var rabbitHole = $scope[dbTable][node1][node2][node3];
...
}
in the html i call it like this
ng-change="makeBasic(item, 'contactData', 'emails', 'data')"
dbTable = "people" which comes from a different var and is working ok.
the end goal for the $scope is this:
$scope.people.contactData.emails.data
I can construct the scope fine with the rabbitHole
variable but that restricts me to only to the 3 variables node1, node2, node3
I am trying to get to the desired $scope with this:
ng-change="makeBasic(item,'contactData.emails.data')"
$scope.makeBasic = function (item, sample) {
var rabbitHole = $scope[dbTable][sample];
...
}
but is not working and is undefined.
this way what ever i put in the var sample ('contactData.emails')
or ('contactData.emails.data...')
etc the $scope can be constructed accordingly
does anyone know what's the solution?