gpt4 book ai didi

javascript - ngRepeat 无法遍历嵌套数组

转载 作者:行者123 更新时间:2023-11-30 10:20:25 29 4
gpt4 key购买 nike

我想访问我的数组数组的每个值:

[
["0","0","0"],
["1","1","1"],
["1","0","0"]
]

我只在里面做了两次 ngRepeat

<ul>
<li ng-repeat="line in test">
{{line}}
<ul>
<li ng-repeat="point in line">
{{point}}
</li>
</ul>
</li>
</ul>

这可能是愚蠢的事情,但我想不通。

这里是直截了当的: http://plnkr.co/edit/LeZw0HRab472dcNiHPQM?p=preview

最佳答案

我认为您正在寻找的是:

<ul>
<li ng-repeat="line in test">

<ul>
<li ng-repeat="point in line track by $index">
{{point}}
</li>
</ul>
</li>
</ul>

http://plnkr.co/edit/72a1Brmn2eBuTWhI8pfC?p=preview

关于javascript - ngRepeat 无法遍历嵌套数组,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21677812/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com