我有json对象数组:
[{id: "gfggf",
name: "name1",
users: [{id: "dfgdgdffg", username: "user1"}, {id: "45535", username: "user2"}]}
]
和ng-repeat:
<div ng-repeat="group in groups">
<h3>{{group.name}}</h3> // name1
</div>
我需要在ng-repeat中显示用户数组,(user1,user2)。我需要最多的表现方式。
答案 0 :(得分:2)
内部重复:
<div ng-repeat="group in groups">
<h3>{{group.name}}</h3>
<p ng-repeat="user in group.users">{{user.username}}</p>
</div>
答案 1 :(得分:0)
您可以像这样简单地嵌套:
<div ng-repeat="group in groups">
<h3>{{group.name}}</h3>
<div ng-repeat="user in group.users">
<h4>{{user.username}}</h3>
</div>
</div>