of-repeat JSON AngularJS

ng-repeat JSON AngularJS

我在想如何访问具有动态名称的 JSON:

AngularJS http-get:

.then(function (response) {
                    $scope.GTMcontainersAccount = response.data;
                    console.log($scope.GTMcontainersAccount);

回复JSON:

{
    "Account2": [{
        "accountId": "*******",
        "containerId": "*******",
        "name": "Container23"
    }, {
        "accountId": "*******",
        "containerId": "*******",
        "name": "Container2"
    }],
    "Account 1": [{
        "accountId": "*******",
        "containerId": "*******",
        "name": "Container1"
    }]
}

我的目标是在 table 中使用 ng-repeat 来显示如下:

AccountName | AccountId | containerId | name
  Account2  |  *******  |   *******   | Container23
  Account2  |  *******  |   *******   | Container2
  Account1  |  *******  |   *******   | Container1

如何使用控制器输出这样的东西table?

试试这个

<table>
<thead>
  <tr>
    <th>AccountName</th>
    <th>AccountId</th>
    <th>containerId</th>
       <th>name</th>
  </tr>
</thead>
<tbody ng-repeat="(k,v) in data">
  <tr ng-repeat="(k1,v1) in v">
    <td>{{k}}</td>
    <td >{{v1.accountId}}</td>
    <td >{{v1.containerId}}</td>
    <td >{{v1.name}}</td>
  </tr>
</tbody>