我正在使用角度構建來自JSON API調用的數據表。我不得不使用嵌套的ngRepeat,但是當行有幾個空字符串時,我看到奇怪的結果,其中整個錶行缺失。ngRepeat:dupes - 使用嵌套的ngrepeat和空字符串在中繼器中複製
我可以用下面的plunk重現。 http://plnkr.co/edit/VCzzzPzfgJ95HmC2f83P?p=preview
<script>
function MyController($scope){
$scope.test = {"rows":[
["one","two","three"],
["one","two","three"],
["one","","three"],
["one","",""],
["","two",""],
["","","three"],
["one","two","three"],
["one","two","three"],
]};};
</script>
<div ng-app ng-controller="MyController">
<table>
<tr ng-repeat="(key,ary) in test.rows">
<td>{{key}}</td>
<td ng-repeat="value in ary">{{value}}</td>
</tr>
</table>
</div>
通知時的陣列具有兩個空字符串嵌套ngRepeat出現失敗。
我會生氣嗎?有沒有對此進行解釋?
非常感謝! 認真想知道這裏.....爲什麼代碼不讓它默認?????? – 2015-07-03 00:19:56
很好的解釋和工作代碼。 - 謝謝! – SeanRamzan 2016-11-30 01:35:18