I am currently attempting to showcase all the books within a specific series. Initially, I utilized nested ng-repeat and achieved the desired outcome. However, with recent modifications to the layout requirements, I am no longer able to use nested ng-repeat (my goal is to have a single list of books). Ideally, it would look something like the example below:
<ul>
<li>book 1 of series 1</li>
<li>book 2 of series 1</li>
<li>book 1 of series 2</li>
<li>book 2 of series 2</li>
<li>book 1 of series 3</li>
<li>book 2 of series 3</li>
</ul>
Is there a way to achieve this using only one ng-repeat? Or perhaps by employing another method like an Array?
Data
var data = {
"records": [
{
"name": "Spectrum Series",
"seriesid": "SpectrumSeries",
"book": [
{
"name": "White Curse",
"bookid": "WhiteCurse",
"image": "book1"
},
{
"name": "Blue Fox",
"bookid": "BlueFox",
"image": "book2"
}
]
}
… additional series
]
};
Controller
$scope.serieslist = data.records;
HTML
<div ng-repeat="series in serieslist">
<ul>
<li ng-repeat="book in series.book">
<div>{{series.name}}</div>
<div>{{book.name}}</div>
</li>
</ul>
</div>