Quantcast
Channel: Active questions tagged html - Stack Overflow
Viewing all articles
Browse latest Browse all 74735

List out values from an array in JSON and display it on a table

$
0
0

I have a table that relies on data from JSON. It consists of the following:

[
  {
"name": "wvwvw",
"description": "wvwv",
"permissions": [
     ],
  }
]

[Permission consists of name and description]

I'm trying to display my information like this (Note how the comma separates them): Example

My AngularJS and HTML consist of the following:

HTML

<td data-title="'Permissions'" sortable="'permissions'">
                        <span ng-repeat="permission in administrativePermissionsForRoles[entity.name]">
                            <i>{{permission.name}}</i><br>
                        </span>
                        </td>

AngularJS

$scope.refreshAdministrativeRolesTable = function() {
        SpringDataRestService.query(
            {
                collection: "administrativeRoles"
            },
            function (response) {
                var adminRoles = response;
                $scope.adminRoleTableOptions = new NgTableParams({}, {
                    dataset: adminRoles,
                    counts: [],
                });
                for (var i = 0; i < adminRoles.length; i++) {
                    console.log(adminRoles.length);
                    var adminRole = adminRoles[i];
                    // It seems that this part onwards is not working
                    $http.get(adminRole.permission).then((function (adminRole) {
                        return function(response) {
                            $scope.administrativePermissionsForRoles[adminRole.name] = response.permissions;
                            console.log("hit me")
                        };
                    })(adminRole));
                }
            },
            function (response) {
                // TODO: Error Handling
            }
        );
    };

Viewing all articles
Browse latest Browse all 74735

Latest Images

Trending Articles



Latest Images