【angularjs基础】ng-repeat嵌套循环报错angular.min.js:89 Error: [ngRepeat:dupes]

再写嵌套循环的时候,提示一个错误

angular.min.js:89 Error: [ngRepeat:dupes]

代码如下

<table class="GridViewTable mtop5px " style="margin-top: 15px;" id="tabVipHallRegisterList" ng-app="" ng-controller="JSJ.CRM.AppFeedBackList.RequestData">
        <tr class="text_center">
            <th style=" 60px">编号</th>
            <th style=" 80px">会员姓名</th>
            <th style=" 80px">手机号</th>
            <th style=" 150px">反馈内容</th>
            <th style=" 80px">反馈时间</th>

            <th style=" 80px">公司</th>
            <th style=" 80px">问题类型</th>
            <th style=" 80px">上传图片</th>

            <th style=" 80px">消息类型</th>
            <th style=" 90px">消息来源</th>
            <th style=" 150px">答复内容</th>
            <th style=" 80px">答复时间</th>
            <th style=" 100px">反馈奖励</th>
            <th style=" 50px">操作</th>
        </tr>
        <tr class="text_center" ng-repeat="x in AppFeedBackList | orderBy:orderProp">
            <td ng-bind="x.CommentsID"></td>
            <td ng-bind="x.CustomerName"></td>
            <td ng-bind="x.Telephone"></td>
            <td ng-bind="x.CommentsS" onclick="ShowDetailContent(this)" onmouseover="ShowDetailContent(this)" @*onmouseout="layer.closeAll();"*@ detailcontent="{{x.Comments}}"></td>
            <td ng-bind="x.CreateTime"></td>

            <td ng-bind="x.QuestionSourceFromDsec"></td>
            <td ng-bind="x.QuestionTypeDsec"></td>

            <td>
                <span ng-repeat="i in x.ListImageUrl">
                    <img src="{{i}}" style="45px;height:45px;" onclick='ShowImage(this)' url="{{i}}" />
                </span>
            </td>

            <td ng-bind="x.MessageType"></td>
            <td ng-bind="x.SourceWay"></td>
            <td>
                <input ng-if="x.IsReply" type="button" p="{{ x.CommentsID }}" style="50%;" comments="{{x.Comments}}" jsjid="{{x.JSJID}}" value="答复" name="btnReply" />

                <label ng-if="!x.IsReply" onclick="ShowDetailContent(this)" onmouseover="ShowDetailContent(this)" @*onmouseout="layer.closeAll();"*@ detailcontent="{{x.ReplayContent}}">{{x.ReplayContentS}}</label>
            </td>
            <td ng-bind="x.ReplayTime"></td>
            <td>
                <input ng-if="x.IsTake" type="button" name="btnReward" p="{{ x.CommentsID }}" style="50%;" comments="{{x.Comments}}" jsjid="{{x.JSJID}}" value="奖励" />
                <label ng-if="!x.IsTake">{{x.RewardTips}}</label>
            </td>
            <td>
                <input type="button" name="btnDel" style="80%;" p="{{ x.CommentsID }}" value="删除" />
            </td>
        </tr>
    </table>

报错截图

跟踪原因

http://blog.csdn.net/ligang2585116/article/details/50490307

解决方案

在对应的ng-repeat指令中增加track by $index

修改代码

<td>
                <span ng-repeat="i in x.ListImageUrl track by $index">
                    <img src="{{i}}" style="45px;height:45px;" onclick='ShowImage(this)' url="{{i}}" />
                </span>
            </td>

最后可以在同一行,生成多个图片标签

搞定!

原文地址:https://www.cnblogs.com/jhli/p/7543655.html