Looking to create an object structure like the one below:
$scope.allBooks = {
books:[
{
name:"",
id:""
}
{
name:"",
id:""
}
// additional objects can be added here
]
books:[
{
name:"",
id:""
}
{
name:"",
id:""
}
]
}
I want to be able to add more objects to 'books' and also add more arrays to 'allBooks'. Here is my proposed solution:
$scope.allBooks = {};
$scope.allBooks.books= [];
var b= {
name:"",
id:""
};
$scope.allBooks.books.push(b);
However, I am facing the challenge of how to add more objects to 'books' and more arrays to 'allBooks'?