0

I have an object which contains many objects. The objects property is a users name property contains an object who's properties are groups and the value is either true or false.

ReportModel.Taxonomy = {
    Authenticated Users: Object
    Test Group 1: " ✓ "
    Test Group 2: " ✓ "
    Test Group 3: " - "
    Test Group 4: " - "
    Test Group 5: " ✓ "
    Test Group 6: " - "
    Test Group 7: " - "
    Test Group 8: " ✓ "
    TestGroup: " - "
Test Users: Object
    Test Group 1: " - "
    Test Group 2: " - "
    Test Group 3: " - "
    Test Group 4: " ✓ "
    Test Group 5: " - "
    Test Group 6: " ✓ "
    Test Group 7: " - "
    Test Group 8: " - "
    TestGroup: " - "
}

I've been trying to create a table using ng-repeat where each row, after the headers, provides the username (column 1) and the result for each of the groups:

    <table>
        <tr class="reportHeader" >
            <th>USERS</th>
            <th ng-repeat="group in ReportModel.groups">{{group.name}}</th>
        </tr>
        <tr ng-repeat="user in ReportModel.taxonomy">
            <td>{{user.name}}</td>
            <td ng-repeat="user.userGroups"></td>
        </tr>
    </table>

I can't figure out how to use ngRepeat given the way the Taxonomy object is set up.

Batman
  • 5,563
  • 18
  • 79
  • 155

1 Answers1

1

Is this what you're trying to do: How can I iterate over the keys, value in ng-repeat in angular

for example:

<table>
    <tr ng-repeat="(key, user) in ReportModel.taxonomy">
        <td>{{key}}</td>
        <td ng-repeat="(key, group) in user"></td>
    </tr>
</table>
Community
  • 1
  • 1
cwohlman
  • 763
  • 6
  • 21