Angularjs JSON键包含空格
我有以下json,需要在表中显示其名称为“PAY ALL”、“PAY PART”、“DECLINE”,但该键包含其中的空格,并且其对应的PAY ALL、PAY PART值需要显示在对应的表行数据中。我怎样才能做到这一点。 我的json对象如下-Angularjs JSON键包含空格,angularjs,json,Angularjs,Json,我有以下json,需要在表中显示其名称为“PAY ALL”、“PAY PART”、“DECLINE”,但该键包含其中的空格,并且其对应的PAY ALL、PAY PART值需要显示在对应的表行数据中。我怎样才能做到这一点。 我的json对象如下- $scope.tableData={ "KEY-1": "VALUE-1", "KEY-2": "VALUE-2", "data": { "PAY ALL": {
$scope.tableData={
"KEY-1": "VALUE-1",
"KEY-2": "VALUE-2",
"data": {
"PAY ALL": {
"NumberOfBills": "1800000",
"CummalativeBillAmount": "45000000",
"ResponseProgress": "60"
},
"PAY PART": {
"NumberOfBills": "6000000",
"CummalativeBillAmount": "15000000",
"ResponseProgress": "20"
},
"DECLINE": {
"NumberOfBills": "3000000",
"CummalativeBillAmount": "7500000",
"ResponseProgress": "10"
},
"REQUEST EXTENSION": {
"NumberOfBills": "240000",
"CummalativeBillAmount": "6000000",
"ResponseProgress": "8"
}
}
}
我还需要从上面的json响应实现下表-
我在html绑定中尝试了以下内容,但没有显示任何内容
<tr ng-repeat="dataValue in tableData">
<td><img src="./assets/images/Group 384@2x.png" class="img-bo"/></td>
<td>{{dataValue.data["PAY ALL"]}}</td>
<td><div class="bg">{{dataValue.data.NumberOfBills}}</div></td>
<td><div class="bg">{{dataValue.data.CummalativeBillAmount}}</div></td>
<td><div class="bg">{{dataValue.data.ResponseProgress}}</div></td>
</tr>
{{dataValue.data[“支付所有”]}
{{dataValue.data.NumberOfBills}}
{{dataValue.data.cummativebillamount}}
{{dataValue.data.ResponseProgress}
请帮助。您的代码应该是
<table>
<tr>
<th>category </th>
<th>no of bills</th>
<th>commulative amount</th>
<th>response</th>
</tr>
<tr ng-repeat="(key,value) in tableData.data">
<td>{{key}}</td>
<td><div class="bg">{{value.NumberOfBills}}</div></td>
<td><div class="bg">{{value.CummalativeBillAmount}}</div></td>
<td><div class="bg">{{value.ResponseProgress}}</div></td>
</tr>
</table>
类别
帐单数目
累计金额
响应
{{key}}
{{value.NumberOfBills}}
{{value.CummalativeBillAmount}}
{{value.ResponseProgress}
“我的json对象如下…”这不是json。JSON是用于数据交换的文本表示法。如果您处理的是JavaScript源代码,而不是字符串,那么就不是JSON。