gpt4 book ai didi

angularjs - $index问题的 Angular 跟踪

转载 作者:行者123 更新时间:2023-12-03 06:59:20 25 4
gpt4 key购买 nike

我正在使用 ng-repeat 来渲染我的 html,这里是代码片段

<ul>
<li ng-repeat="feed in feeds | orderBy:'title'">
<p class="status-text">
{{feed.title}}
<a ng-href={{feed.link}} class="status-url">
{{feed.link}}
</a>
</p>
</li>
</ul>

这成功地对列表进行了排序,但出现了错误,错误:[ng-repeat dupes]。我查看了文档并将 ng-repeat 行修改为

<li class="live_mvc_element" ng-repeat="feed in feeds track by $index | orderBy:'title'">

我通过 $index 添加了轨道,错误已解决,但现在尚未排序。有什么解决方案可以解决错误并且列表也得到排序?

最佳答案

试试这个:feed in feeds | orderBy: 'title' 轨道按 $index"

来源:github

关于angularjs - $index问题的 Angular 跟踪,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24226333/

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