basically I have an array that I pull data from. I would like to add a new array to it so I can pull additional data.

```
var myArray.libraries = []

```

gets items added via a for loop like this:

```
for(var x=0; x < items.length; x++){
    myArray.libraries ({ name: items(x).name, state: items(x).state});
}

```

that works great and I can get what I need from `myArray.libraries .name`. I need to add something like "books" so each entry can have it's list of books. There could be 1 or more books.

to be clear I'm using angular so I use something like this to output for each library:

```
<div ng-repeat="library in libraries">
    <p>{{library.name}}</p>
</div>

```

I just need to add `books` so I can loop through each book in that library:

```
<div ng-repeat="book in libraries.books">
    <p>{{book.name}}</p>
</div>

```

I tried using `myArray.libraries.books = []` but that didn't add the collect to each library. I also tried `myArray.libraries.push({ books: { } })` but that didn't have any affect and gave me an error that I couldn't push to `myArray.libraries.books` since books didn't exist.

EDIT

Here's some sample code. I'm using angular but the principle should be the same:

```
$scope.libraries= [];

//start loop to get the installations
for (var x = 0; x < res.rows.length; x++) {
    $scope.libraries.push({ ... , books: []});

    //run a new query to get the additional libraries info
    var booksQuery = query to get books;
    //run query to get results and loop through them
        for (var i = 0;i < res2.rows.length; i++) {
            $scope.libraries[x].books.push({ name: res2.rows.item(i).prodName });
        }
    });
}

```

**EDIT**

I ran some tests and it turns out when I do my second database call it doesn't know the original `$scope` exists.