The returned json response data from http post is the following:
{"ResponseData":[["AUSTRALIA","VICTORIA","MELBOURNE"],["AUSTRALIA ","NEW SOUTH WALES","SYDNEY"]]}
Controller code:
app.controller('tableController', function ($scope)
{
$scope.customerTable = [];
$scope.getTable = function ()
{
$http.get('getTable.do').success(function (data)
{
$scope.customerTable = data;
});
};
});
Here is my div:
<div ng-controller="tableController">
<p> Click <a ng-click="getTable()">here</a> to load data.</p>
<table>
<tr>
<th>COUNTRIES</th>
<th>STATES</th>
<th>CITIES</th>
</tr>
<tr ng-repeat="data in customerTable">
<td>{{data[0]}}</td>
<td>{{data[1]}}</td>
<td>{{data[2]}}</td>
</tr>
</table>
</div>
When I use ng-repeat to load the data its just displaying it as {{data.country}} rather than actual value. There's no server side problem as I am getting response back but unable to understand why data is not displayed in the table?
{{expr}}.data.country,data.stateanddata.citybut you don't handle any kind of objects with those properties (eg, obj = { country: 'Australia', state: 'Victoria', city: 'Melbourne' }). You only have an array of arrays. Maybe you should consider redesign the response so you won't need to iterate over an array of arrays and then assign each index from an inner array being thecountry, thestateand thecityin this order.$httpas parameter.