gpt4 book ai didi

angularjs - 在 Set 上使用 ng repeat

转载 作者:行者123 更新时间:2023-12-01 00:39:16 25 4
gpt4 key购买 nike

我有一个 vm.s = new Set([1,2,3])
我如何使用 ngRepeats不将其转换为数组?

我试过了

<option ng-repeat="o in vm.s">{{o}}</option>
<option ng-repeat="o in vm.s.values()">{{o}}</option>
<option ng-repeat="o in Array.from(vm.s)">{{o}}</option>

最佳答案

Set() 是 ECMAScript 6 的一项功能。 Angular 1.x 不直接支持 ES6 特性。 Array.from(vm.s)应该为你工作。

关于angularjs - 在 Set 上使用 ng repeat,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38486827/

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