中继器错误中的重复键 [ngRepeat:dupes]

Duplicate Key in Repeater Error [ngRepeat:dupes]

我猜我遇到了成像错误。我不确定错误的来源。

注意:有时工作顺利,我经常遇到这个错误。

形式:

<div class="wrapper" ng-app='afApp' ng-controller='afController'
     style="background: #F8F8F8;padding-top: 10px;">
    <div class="container-fluid">
        <div class="row">
            <input type="search" size="40" ng-model="search" id="search"
                   autofocus="autofocus" autocomplete="off">
            <section ng-repeat="afData in afLoad | filter:search | limitTo:10"
                     ng-show='search' md-highlight-text="search">
                <div class="row">
                    <div class="col-sm-6 text-center">
                        <h2>{{afData.yil}}</h2>
                        <h3>{{afData.sik1}}</h3>
                    </div>
                    <div class="col-sm-6">
                        <p>{{afData.soru}}</p>
                    </div>
                </div>
            </section>
        </div>
    </div>
</div>

控制台[浏览器]:

Error: [ngRepeat:dupes] http://errors.angularjs.org/1.2.15/ngRepeat/dupes?p0=afData%20in%20afLoad%20%7C%20filter%3Asearch%20%7C%20limitTo%3A10&p1=string%3A%3C

控制台 [SSH]:

(node:4015) [DEP0096] DeprecationWarning: timers.unenroll() is deprecated. Please use clearTimeout instead.

我会按照错误中的说明使用曲目。在你的 ng-repeat 中的某个时刻,必须有不唯一的对象。

以下应该足够了:

ng-repeat="afData in afLoad | filter:search | limitTo:10 track by $index"

https://docs.angularjs.org/api/ng/directive/ngRepeat#tracking-and-duplicates