click()
任务对象
{" task_date_id":69069" TASK_ID":" 3286"" START_TIME":" 2018-02- 22 12:10:00"," end_time":" 2018-02-22 12:10:00"," overdue_days":0,&# 34受试者#34;:" Oneone""描述":"一个""状态" {" ID&# 34;:3,"名称":"待定""启用":空,"完整":空}"状态":[{" ID":3,"名称":"待定"},{" ID":6,& #34;名称":"已分配"},{" ID&#34:4,"名称":"封闭"},{ " ID":17,"名称":"完整"}],"类型" {" ID&#34 ;: 229,"名称":" 200_Test_Mobile_Task"}," assigned_to":" Kanishka Raveendra","地址":& #34;""客户":[],"附件":[],"笔记":[]," $$ hashKey":"对象:8112"}
注意对象
{" note_id":" 98834"" note_date":" 22/02/2018"" note_type&# 34;:" ABC14"" time_spent":0,"注意":" Xyxhxffuf \ n
{$ PERSON_FIRST_NAME} {$ PERSON_SURNAME}
"" CREATED_BY":"伽腻色迦 Raveendra"" DATE_CREATED":"""附件":[],"模板":"{$ PERSON_FIRST_NAME} {$ PERSON_SURNAME}
""类型" {" ID":52,"名称":" ABC14&#34 ;,"启用":真," RECORD_TIME":" START_STOP"}}
这里我添加了我用来显示数据的任务和注释的源代码和响应。通常一个任务可以有多个注释。但是这里我们可以看到注释数组没有元素。但我可以看到一些注释View中的其他任务的对象。我需要在View中显示正确的音符值。请帮助我。我是离子的新手。
控制台错误
错误:[ngRepeat:dupes]不允许在转发器中重复。使用'跟踪'表达式以指定唯一键。 Repeater:注意在taskDetails.notes中跟踪note.note_id,重复键:98834,重复值:{" note_id":" 98834"," note_date":& #34; 22/02/2018"" note_type":" ABC14"" time_spent":0,"注意&#34 ;: " Xyxhxffuf \ n
{$ PERSON_FIRST_NAME} {$ PERSON_SURNAME}
"," created_by":" Kanishka Raveendra", " DATE_CREATED":"""附件":[],"模板":"{$ PERSON_FIRST_NAME} {$ PERSON_SURNAME}
""类型" {" ID":52,"名称":" ABC14&#34 ;,"启用":真," RECORD_TIME":" START_STOP"}}
答案 0 :(得分:2)
在track by note.note_id
获得相同的值。
使用$index
,它是ng-repeat
中重复元素(0..length-1)的迭代器偏移量。
请从here查看更多详情。
使用以下解决方案:
<ion-item
class="item-icon-left item-icon-right item-avatar"
ng-repeat="note in taskDetails.notes track by $index"
ng-click="viewNote(note)">
<i class="icon" ng-class="{'ion-ios-circle-outline': note.status.name === 'Open', 'ion-ios-checkmark-outline': note.status.name !== 'Open'}"></i>
<h2>{{note.note}}</h2>
<p>{{note.created_by}}</p>
<i class="icon ion-chevron-right icon-accessory"></i>
</ion-item>
希望这会对你有所帮助!!
答案 1 :(得分:1)
试试这个
<ion-item
class="item-icon-left item-icon-right item-avatar"
ng-repeat="(key, value) in taskDetails.notes track by $index"
ng-click="viewNote(note)">
......
</ion-item>