问题描述
我有需要添加到表中的JSON文件。我无法更改JSON文件。不管我做什么,我似乎都无法正确创建表。我在做什么错了?
{
"results": [
{
"statement_id": 0,"series": [
{
"name": "car_data","tags": {
"car_types_tag": "toyota"
},"columns": [
"year","model","brand","style","seats","color"
],"values": [
[
2005,"highlander","toyota","suv",7,"blue"
]
]
},{
"name": "car_data","columns": [
"year","values": [
[
2020,"camry",5,"green"
]
]
},"tags": {
"car_types_tag": "tesla"
},"values": [
[
2019,"model s","tesla","white"
]
]
}
]
}
]
}
import angular from 'angular';
angular.module("dash",[])
.controller("dashcontroller",["$scope","$http",function($scope,$http) {
$scope.message = "QA dash";
$scope.$watch('getData',function() {
getCarData();
});
function getCarData() {
$scope.CarTable = new Array;
{
var url = "carData.json";
$http.get(url).then(function(response) {
$scope.CarTable = response.data.results;
})
};
}
}]);
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.6.9/angular.min.js"></script>
<div ng-app="dash">
<div id='mainContent' ng-controller="dashcontroller">
<div class="bgc-white bd bdrs-3 p-20 mB-20" ng-repeat="results in CarTable">
<table id="dataTable" class="table table-striped table-bordered" cellspacing="0" width="100%">
<thead>
<tr>
<th>year</th>
<th>model</th>
<th>brand</th>
<th>style</th>
<th>seats</th>
<th>color</th>
</tr>
</thead>
<tbody ng-repeat="series in results">
<tr>
<td ng-repeat="values in series">
<div>{{series}}</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
{
"results": [
{
"statement_id": 0,"white"
]
]
}
]
}
]
}
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)