我有来自服务器的这个 JSON 模型:
[
{
id:"open",
title: "Opened",
items: [
{ id:"id-1", img: "img/c/1.jpg", title: "Title 1" },
{ id:"id-2", img: "img/c/2.jpg", title: "Title 2" }
]
},
{
id:"closed",
title: "Closed",
items: [
{ id:"id-5", img: "img/c/5.jpg", title: "Title 5" },
{ id:"id-6", img: "img/c/6.jpg", title: "Title 6" }
]
},
{
id:"other",
title: "Other",
items: [] //empty
}
]
如何使用 AngularJS 获得此视图?
<section>
<div class="group">
Opened
</div>
<div class="item">
<div class="img" style="background-image: url(img/c/1.jpg)"></div>
<div class="store-item-info">Title 1</div>
</div>
<div class="item">
<div class="img" style="background-image: url(img/c/2.jpg)"></div>
<div class="store-item-info">Title 2</div>
</div>
<div class="group">
Closed
</div>
<div class="item">
<div class="img" style="background-image: url(img/c/5.jpg)"></div>
<div class="store-item-info">Title 5</div>
</div>
<div class="item">
<div class="img" style="background-image: url(img/c/6.jpg)"></div>
<div class="store-item-info">Title 6</div>
</div>
</section>
ngRepeat 还是别的什么?使用普通数组我没有问题,但这是一个复杂的模型(带有子项的数组),我想将它显示为没有嵌套的普通列表。