Ошибка ng-repeat: "Дубликаты в повторителе не допускаются"

Вот мой html,

Я осознаю,

[Duplicates in a repeater are not allowed. Use 'track by' expression to specify unique keys. Repeater: val in attribute.format.values, Duplicate key: object:07F, Duplicate value: {2}][1]

Вот мой JSON,

[{
 "name": "Auto",
 "weight": "1",
 "value": "1",
 "count": 0,
 "min": 0,
 "max": 0,
 "children": [],
 "id": "06c9f57c-963f-4977-bca5-9226e971a8dc",
 "visible": true,
 "$$hashKey": "06V"
}, {
 "name": "On",
 "weight": "1",
 "value": "2",
 "count": 0,
 "min": 0,
 "max": 0,
 "children": [],
 "id": "dc019b87-1da5-4f21-b91f-4ee35ec04eb8",
 "visible": true,
 "$$hashKey": "06W"
}, {
 "name": "Off",
 "weight": "1",
 "value": "4",
 "count": 0,
 "min": 0,
 "max": 0,
 "children": [],
 "id": "daf8ef80-a2da-4e02-8960-791b8528905e",
 "visible": true,
 "$$hashKey": "06X"
}, {
 "name": "Redeye Reduction",
 "weight": "1",
 "value": "5",
 "count": 0,
 "min": 0,
 "max": 0,
 "children": [],
 "id": "87ccb4ee-39cd-4bd0-9817-7e477af6d5b0",
 "visible": true,
 "$$hashKey": "06Y"
}, {
 "name": "Slow Sync",
 "weight": "1",
 "value": "6",
 "count": 0,
 "min": 0,
 "max": 0,
 "children": [],
 "id": "e0b14c8b-af4b-4ab8-a533-32ac4829613f",
 "visible": true,
 "$$hashKey": "06Z"
}, {
 "name": "High Speed Sync",
 "weight": "1",
 "value": "7",
 "count": 0,
 "min": 0,
 "max": 0,
 "children": [],
 "id": "622c7ebf-067c-46ed-913a-ba045a0586df",
 "visible": true,
 "$$hashKey": "070"
}, {
 "name": "Front Curtain",
 "weight": "1",
 "value": "8",
 "count": 0,
 "min": 0,
 "max": 0,
 "children": [],
 "id": "fe12c21c-e2c3-4702-ae9b-82f2fe248574",
 "visible": true,
 "$$hashKey": "071"
}, {
 "name": "Rear Curtain",
 "weight": "1",
 "value": "9",
 "count": 0,
 "min": 0,
 "max": 0,
 "children": [],
 "id": "4a229ebb-d029-4b1e-a13d-246d00215900",
 "visible": true,
 "$$hashKey": "072"
}, {
 "name": "Fill-in",
 "weight": "1",
 "value": "10",
 "count": 0,
 "min": 0,
 "max": 0,
 "children": [],
 "id": "a7ed372d-398f-4614-8efa-64a338f0ad20",
 "visible": true,
 "$$hashKey": "073"
}, {
 "name": "Wireless",
 "weight": "1",
 "value": "11",
 "count": 0,
 "min": 0,
 "max": 0,
 "children": [],
 "id": "b36ab529-feab-42aa-8863-2a7084ac0aba",
 "visible": true,
 "$$hashKey": "074"
}, {
 "name": "Redeye Reduction with Slow Sync",
 "value": "12",
 "weight": "1",
 "visible": true,
 "id": "23e**ac2-1b8b-41a7-ae80-aa4fcd8134ae",
 "$$hashKey": "07F"
}, {
 "name": "Slow Rear-Curtain Sync",
 "value": "13",
 "weight": "1",
 "visible": true,
 "id": "f5835da6-4eac-4878-a8c0-3f91cd22372f",
 "$$hashKey": "07J"
}, {
 "name": "Repeating or Strobe",
 "value": "14",
 "weight": "1",
 "visible": true,
 "id": "8f3bb252-****-426a-9781-d1232a0a4845",
 "$$hashKey": "0CW"
}, {
 "name": "Rear Sync",
 "value": "15",
 "weight": "1",
 "visible": true,
 "id": "d668aa49-a999-4638-8af2-5e9eaafd6e75",
 "$$hashKey": "06L"
}, {
 "name": "Fill-Flaw",
 "value": "16",
 "weight": "1",
 "visible": true,
 "id": "00f92889-05f9-45fc-b3de-37e224991548",
 "$$hashKey": "08D"
}, {
 "name": "Advanced Flash",
 "value": "17",
 "weight": "1",
 "visible": true,
 "id": "d49c3d25-2bf5-4723-b7d4-c3ae36783097",
 "$$hashKey": "079"
}, {
 "name": "Fill-Flash",
 "value": "18",
 "weight": "1",
 "visible": true,
 "id": "4693db2a-19c7-4839-8***-875e36416c63",
 "$$hashKey": "0ER"
}, {
 "name": "Smart Flash",
 "value": "19",
 "weight": "1",
 "visible": true,
 "id": "8b04d59b-75cc-46ff-acc0-33f410f64a09",
 "$$hashKey": "07D"
}, {
 "name": "",
 "value": "",
 "weight": "",
 "visible": true,
 "id": "18cec753-48fe-47**-9**7-1bb36972bee4",
 "$$hashKey": "07F"
}, {
 "name": "",
 "value": "",
 "weight": "",
 "visible": true,
 "id": "a7fbad1d-2a49-40e7-a9b1-520db0f9fc65"
}]
2 ответа

Редактировать как это

id может быть идентификатором объектов, поэтому вы можете использовать свойство id, которое будет содержать один объект, если вы добавите два объекта, которые по ошибке обмениваются одним и тем же id.


Попробуй это:

вы можете использовать 'track by $ index'

licensed under cc by-sa 3.0 with attribution.