我想显示从PHP文件返回因为这样我JSON数据:为什么我的Json数据没有使用角度ng-repeat显示在表格中?
“{\” 成功\ “:真实的,\” 消息\ “:\”。交易纪录发现\ “\” user_transactions \ “:[{\” USER_ID \ “:\” 4 \ “\ ”amount_charged \“:\ ”4.00 \“,\ ”amount_transferred \“:\ ”14400.00 \“,\ ”app_rate \“:\” 3600.00 \ “\ ”charged_currency \“:\ ”USD \“,\ ”beneficiary_phone \“:\ ”256775542757 \“,\ ”beneficiary_first_name \“:\ ”Sapkota \“,\ ”beneficiary_last_name \“:\” 苏雷什\ ”,\ “beneficiary_country \”:\ “UG \”,\ “transferred_currency \”:\ “UGX \”,\ “transaction_status \”:\ “传递\”,\ “ORDER_ID \”:\ “259 \”, \“created_date \”:\“2017-07-25 13:35:48 \”,\“last_modified_date \”:\“2017-07-25 13:35:48 \”},{\“user_id \”: \ “4 \” \ “amount_charged \”:\ “5.00 \”,\ “amount_transferred \”:\ “18000.00 \”,\ “app_rate \”:\ “3600.00 \”,\ “charged_currency \”:\” USD \ “\ ”beneficiary_phone \“:\ ”256775542757 \“,\” 是neficiary_first_name \ “:\” Sapkota \ “\ ”beneficiary_last_name \“:\ ”苏雷什\“,\ ”beneficiary_country \“:\ ”UG \“,\ ”transferred_currency \“:\ ”UGX \“,\” transaction_status \ “:\”Delivered \“,\”order_id \“:\”258 \“,\”created_date \“:\”2017-07-25 06:23:05 \“,\”last_modified_date \“:\”2017 -07-25 06:23:05 \ “}]}”
这是取使用Get像:
$http.get("clients.php").then(function (response) {
$scope.response = response;
$scope.results = JSON.parse(response.data);
console.log($scope.results);
}
的问题是,不要在控制台任何结果.LOG &我用这种方式写的表格行里没有任何东西。所以,任何人都请帮助我。
<table>
<tr ng-repeat="result in results.user_transactions">
<td>{{ result.beneficiary_first_name}}</td>
<td>{{ result.transaction_status }}</td>
</tr>
</table>
您的数据串。首先使用JSON.parse解析它uisng() – Ved
为什么你不安慰响应?先检查一下。 –
控制台响应,我得到:对象{数据:“”{\“成功\”:真,\“消息\”:\“交易历史...”last_modified_date \“:\”2016-11-01 16:55 :31 \“}]}”“,status:200,config:Object,statusText:”OK“,headers:function} –