Within my controller, I am managing arrays that contain object items like so:
$scope.johnny = [
{quote: "Anything for My Princess", path: 'sounds/AnythingForMyPrincess.mp3'},
{quote: "Don't Even Ask", path: 'sounds/DontEventAsk.mp3'},
{quote: "Don't Plan Too Much", path: 'sounds/DontPlanTooMuch.mp3'}
] // an example of one of the many lists
I am looking to iterate through these lists using another array (names of arrays) and a for loop:
$scope.totalNames = [$scope.johnny, $scope.lisa, $scope.mark, $scope.denny, $scope.lisasmom,
$scope.chicken, $scope.chris, $scope.flower, $scope.mike, $scope.steven]
for (var i = 0; i < $scope.totalNames.length; i++) {
var list = $scope.totalNames[i];
alert(list.quote);
}
While $scope.totalNames[i] correctly returns the desired array, once I add .quote to it, it returns undefined. Any insights on why this might be happening? Thank you!