#Permission Category: Code
Permission: Add Role: Developer
Permission: Edit Role: Developer
Permission: Delete Role: Developer
Permission: Delete Role: Project Lead
#Permission Category: Project
Permission: Add Role: Admin
Permission: Edit Role: Project Manager
Permission: Delete Role: Project Manager
Permission: Delete Role: Product Owner
#Permission Category: Testing
Permission: Add Role: Tester
Permission: Edit Role: Tester
Permission: Edit Role: Test Lead
Permission: Delete Role: Test Lead
在上面的JSON结构中,我有来自我的REST源的重复列表..例如:
Permission: Delete Role: Developer
Permission: Delete Role: Project Lead
Permission: Edit Role: Tester
Permission: Edit Role: Test Lead
相反,我希望这在UI中显示为:
Permission: Delete Role: Developer
Role: Project Lead
Permission: Edit Role: Tester
Role: Test Lead
我应该如何使用Angular-Filter实现这一目标?
请在此处找到JSBin网址: http://jsbin.com/helanefegu/1/edit?html,js,output
我想在这里找到类似的东西:https://coyotecrk.files.wordpress.com/2011/10/blog2-jira-3.png
答案 0 :(得分:3)
希望这会有所帮助:
Permission Category: {{ key }}
<li ng-repeat="(name, roles) in value | groupBy: 'name'">
Permission: {{ name }}
Role: <span ng-repeat="role in roles" ng-bind="role.role"></span>
</li>