再寫嵌套循環的時候,提示一個錯誤
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="width: 60px">編號</th> <th style="width: 80px">會員姓名</th> <th style="width: 80px">手機號</th> <th style="width: 150px">反饋內容</th> <th style="width: 80px">反饋時間</th> <th style="width: 80px">公司</th> <th style="width: 80px">問題類型</th> <th style="width: 80px">上傳圖片</th> <th style="width: 80px">消息類型</th> <th style="width: 90px">消息來源</th> <th style="width: 150px">答復內容</th> <th style="width: 80px">答復時間</th> <th style="width: 100px">反饋獎勵</th> <th style="width: 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="width: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="width: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="width:50%;" comments="{{x.Comments}}" jsjid="{{x.JSJID}}" value="獎勵" /> <label ng-if="!x.IsTake">{{x.RewardTips}}</label> </td> <td> <input type="button" name="btnDel" style="width: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="width:45px;height:45px;" onclick='ShowImage(this)' url="{{i}}" /> </span> </td>
最后可以在同一行,生成多個圖片標簽
搞定!