Javascript 角重复分组
我正在尝试使用ng repeat显示列表,但我不知道如何将其分组。这是我的json:Javascript 角重复分组,javascript,angularjs,angularjs-ng-repeat,Javascript,Angularjs,Angularjs Ng Repeat,我正在尝试使用ng repeat显示列表,但我不知道如何将其分组。这是我的json: { "id": "1", "name": "Andre Nascimento", "client": "Lojas Mais" }, { "id": "1", "name": "Andre Nascimento", "client": "Fe comercio" }, { "id": "1", "name": "Andre Nascimento", "client": "T
{
"id": "1",
"name": "Andre Nascimento",
"client": "Lojas Mais"
},
{
"id": "1",
"name": "Andre Nascimento",
"client": "Fe comercio"
},
{
"id": "1",
"name": "Andre Nascimento",
"client": "Transtour"
},
{
"id": "2",
"name": "Carla Prata",
"client": "Fe comercio"
},
{
"id": "2",
"name": "Carla Prata",
"client": "Transtour"
}
我想得到下面的结果
Andre Nascimento
*Lojas Mais
*Fe comercio
*Transtour
Carla Prata
*Fe comercio
*Transtour
您可以使用回答中解释的模块。然后你会有类似的
<ul ng-repeat="(key, value) in yourArray| groupBy: 'client'">
Group name: {{ key }}
<li ng-repeat="element in value">
player: {{ element.name }}
</li>
</ul>
组名:{{key}
-
播放器:{{element.name}
这样就可以了。