gpt4 book ai didi

javascript - 如何使用 data-ng-repeat 获取从 A 到 Z 的索引值?

转载 作者:行者123 更新时间:2023-11-30 07:02:24 25 4
gpt4 key购买 nike

我一直在使用这样的索引值:

{{ $index }}

我真正需要的不是获取一个数字,而是获取一个从 A 到 Z 的大写字符。应该没有字符用完的问题,因为我最多只有 10 个重复的东西。

谁能告诉我该怎么做?

最佳答案

将以下方法添加到您的范围:

$scope.indexChar = function (index) {
return String.fromCharCode(65 + index);
};

然后在你的 View 中使用它:

{{ indexChar($index) }}

这是 fiddle :http://jsfiddle.net/Xs5Qn/

关于javascript - 如何使用 data-ng-repeat 获取从 A 到 Z 的索引值?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18815280/

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