I am trying to retrieve a response from an HTTP request using ng-repeat. This is my JSON object:
{
"sessid":"47",
"value":[
{
"_id":"1",
"0":"1",
"_exportid":"47",
"1":"47",
"sender_id":"0",
"2":"0",
"receiver_id":"0",
"3":"0",
"sender_address":"",
"4":"",
"receiver_address":"",
"5":"",
"price_in_btc":"2",
"6":"2",
"price_in_curr":"3",
"7":"3",
"status":"1",
"8":"1",
"account_id":"12",
"9":"12",
"date":"0000-00-00 00:00:00",
"10":"0000-00-00 00:00:00"
},
{
"_id":"2",
"0":"2",
"_exportid":"47",
"1":"47",
"sender_id":"0",
"2":"0",
"receiver_id":"0",
"3":"0",
"sender_address":"",
"4":"",
"receiver_address":"",
"5":"",
"price_in_btc":"2",
"6":"2",
"price_in_curr":"3",
"7":"3",
"status":"1",
"8":"1",
"account_id":"12",
"9":"12",
"date":"0000-00-00 00:00:00",
"10":"0000-00-00 00:00:00"
},
{
"_id":"3",
"0":"3",
"_exportid":"47",
"1":"47",
"sender_id":"46",
"2":"46",
"receiver_id":"47",
"3":"47",
"sender_address":"4504859484",
"4":"4504859484",
"receiver_address":"4584958459",
"5":"4584958459",
"price_in_btc":"0.01",
"6":"0.01",
"price_in_curr":"$200",
"7":"$200",
"status":"0",
"8":"0",
"account_id":"24524",
"9":"24524",
"date":"0000-00-00 00:00:00",
"10":"0000-00-00 00:00:00"
}
]
}
This is my Angular controller:
app.controller('transCtrl', ['$scope', '$http', function ($scope, $http) {
$http.get('http://localhost/bitty/class/v1/getransactions')
.then(function (res) {
var me = res.data.value;
$scope.values = me;
console.log($scope.values);
});
...and here is how I used my ng-repeat:
<tbody>
<tr ng-repeat="val in values">
<td><span class="tablesaw-cell-content">1</span></td>
<td><span class="tablesaw-cell-content">{{val.sender_address}}</span></td>
<td><span class="tablesaw-cell-content">{{val.receiver_address}}</span></td>
<td><span class="tablesaw-cell-content">{{val.price_in_btc}}</span></td>
<td><span class="tablesaw-cell-content">${{val.price_in_curr}}</span></td>
<td><span class="tablesaw-cell-content">{{val.date}}</span></td>
</tr>
</tbody>
Trying this doesn't return anything on the table, I would really appreciate your help.
console.log($scope.values);?ng-repeat="val in values">tong-repeat="val in values.value"