Javascript 在angularjs中使用ng repeat的表内表
我不熟悉Javascript 在angularjs中使用ng repeat的表内表,javascript,css,angularjs,html,Javascript,Css,Angularjs,Html,我不熟悉angularjs和web开发。我使用ng repeat来表示复杂表格中的数据,如下所示: A B C D abc pqr xyz std 这就是代码: <div class="table-responsive"> <table class="table table-striped table-bordered report-table table-fixed" contextmenu-container="meta.c
angularjs
和web开发
。我使用ng repeat来表示复杂表格中的数据,如下所示:
A B C D
abc pqr xyz std
这就是代码:
<div class="table-responsive">
<table class="table table-striped table-bordered report-table table-fixed" contextmenu-container="meta.contextmenu" fixed-header>
<thead class="text-center text-info">
<th class="text-center">A</th>
<th class="text-center">B</th>
<th class="text-center">C</th>
<th class="text-center">D</th>
</thead>
<tr ng-repeat="report in reports.data">
<td class="text-center">{{ report.attributes.annotation }}</td>
<td class="td-report-field" contenteditable="{{enableReportEditing}}" contextmenu-item="report" context-menu="menuOptions">{{ report.attributes.field }}</td>
<td>
<input type="checkbox" ng-if="report.attributes.message && showcheckbox" ng-bind="report.attributes.message" ng-click="getcheckedData(report.attributes.message)">
<span ng-if="report.attributes.message" contentEditable ng-model="report.attributes.message">
{{ report.attributes.message }}
</span>
<span ng-if="!report.attributes.message">{{ report.attributes.message }}</span>
</td>
<td class="text-center">{{ report.attributes.score }}</td>
</tr>
</table>
</div>
现在表应该是这样的-(abc将是父级)
所以,我尝试了一些东西,但没有运气。谁能帮我解决这个问题?任何帮助都会很好 您在ng repeat中提到了错误的数据 ng repeat=“报告中的报告。数据” 换成
ng repeat=“reports.innerAnnotations中的报告”。您还需要更改内部html角度表达式。您在ng repeat中提到了错误的数据 ng repeat=“报告中的报告。数据” 换成
ng repeat=“reports.innerAnnotations中的报告”。您还需要更改内部html角度表达式。console中有错误吗?到底是什么问题?所有数据都正确打印。这是无效的json
innerAnnotations
属性应该有数组对象。@PankajParkar为什么这样认为?控制台中有错误吗?到底是什么问题?所有数据都正确打印。这是无效的jsoninnerAnnotations
属性应该有数组对象。@PankajParkar为什么这样认为?但问题是还需要显示报表数据。你能把完整的JSON结构放进去吗?我相信你已经提到了一部分。但问题是还需要显示报表数据。你能把完整的JSON结构放进去吗?我相信你已经部分提到了。
{
"type": "report",
"id": 14,
"attributes": {
"annotation": "abc",
"field": "pqr",
"message": "xyz",
"score": "7"
},
"innerAnnotations": {
{
"annotation": "jkl",
"field": "pqr",
"message": "xyz",
"score": "6"
},
{
"annotation": "Qualification",
"field": "EFG",
"message": "HIJ",
"score": "5"
}
}
},
A B C D
abc pqr xyz 7
jkl pqr xyz 6
Qualification EFg Hij 5