1
在我的控制,我有這樣的數據...如何使用NG-重複時的動態密鑰值是一個數組
data = {
chartTypes":["pie","donut","bar","line"],
"features":{
"stacked": ["true","true","true","false"],
"percentage":["false","false","true","false"]
}
};
$scope.docStructure = data
有什麼辦法,我可以用戶NG-重複迭代在鍵上並且如果值是數組,則再次迭代?
<div ng-app="chartFeatures" ng-controller="chartFeaturesCtrl" style="height:200px; background:red;">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<th> </th>
<th ng-repeat="chartType in docStructure.chartTypes">{{chartType}}</th>
</tr>
<tr ng-repeat="(feature,supportedList) in docStructure.features">
<td>{{feature}}</td>
<td ng-repeat="supported in supportedList">{{supported}}</td>
</tr>
</table>
</div>
想法是我想做一個交叉表如下。
例子:
什麼是錯誤? –
錯誤:ngRepeat:dupes。 Repeater中的重複鍵 – shibualexis
不要重複原始類型!這是不好的做法。如果你必須,所有ng重複加上'track by $ index' – Mike