将json显示到带有角度的html表中

将json显示到带有角度的html表中,html,angularjs,json,Html,Angularjs,Json,我在表上部署json响应时遇到问题, 这是我的controller.js var app = angular.module('angularjs-starter', []); app.controller('MainCtrl', function($scope, $http) { $scope.choices = [{id: 'choice1'}]; $scope.jsonData = {}; 这是我controller.js中的函数,我在其中发布数据和带有表内容的php响应 $scope.

我在表上部署json响应时遇到问题, 这是我的controller.js

var app = angular.module('angularjs-starter', []);
app.controller('MainCtrl', function($scope, $http) {

$scope.choices = [{id: 'choice1'}];
$scope.jsonData = {};
这是我controller.js中的函数,我在其中发布数据和带有表内容的php响应

$scope.continue = function(choices)
{
var json = $scope.choices;

$http.post('php/calculador.php', json)
 .then(function(response) {

    $scope.jsonData = response;
    console.log($scope.jsonData);

});


};
});
我在控制台中打印了json数据,以确保数据是正确的,而且是正确的,但它不会在我的html表中显示任何数据

这是我的HTML表格 我试图在其中部署json

<div ng-app="angularjs-starter" ng-controller="MainCtrl">
<table>
<tr ng-repeat="x in jsonData">
<td>{{ x.costo_m }}</td>
<td>{{ x.desc }}</td>
<td>{{ x.id }}</td>
</tr>

您的
jsonData
不是一个数组,它是一个似乎只有一个属性
data
的对象,该属性随后包含一个数组数组。不过,内部数组似乎是您想要的


因此,只需替换
$scope.jsonData=response带有
$scope.jsonData=response.data[0]

您的
jsonData
不是一个数组,它是一个对象,它似乎有一个属性
data
,然后包含一个数组。不过,内部数组似乎是您想要的


因此,只需替换
$scope.jsonData=response带有
$scope.jsonData=response.data[0]

哦,很抱歉,我忘了发布我已经尝试过了,没有成功:(我的错。我再次查看,实际上似乎
响应。数据
不是一个数组,而是一个数组数组。我对数据本身不太了解,但似乎您需要
响应。数据[0]
相反。告诉我这是否正确,我会更新我的答案。哦,很抱歉,我忘了发布我已经尝试过了,没有成功:(我的错。我再次查看,实际上似乎
响应。数据
不是一个数组,而是一个数组。我对数据本身不太了解,但似乎您需要
响应。数据[0]
相反。告诉我这是否正确,我会更新我的答案。
Object
data:Array[1]
   0: Array[1]
      0: Object
        costo_m: 18.973529411765
        desc: "BLONG-F25+MOBICTRL"
        id: "choice1"
        licencias: 4.3