Abdul Moiz Abdul Moiz - 2 months ago 9
AngularJS Question

ng-repeat duplicate issue, when there are not any duplicates

$scope.subjects = [
"Computer Security", "Graphics and Multimedia",
"Networks", "Computer Science and Engineering", "Game Design",
"Programming", "Information Technology", "Software Engineering",
"Technology Management", "Telecommunications", "Web Development",
"Environmental Sciences", "Biology", "General", "Aviation",
"Mathematics", "Engineering"];


<label class="concentration-label3" ng-repeat="subject in subjects">
<input type="checkbox" name="concentrations" class="concentration-label3__input js-concentration-value" value="" data-mixpanel-subject="Design">
<span class="concentration-label3__title" for="conc1">
{{subject}}
<span class="concentration-label3__title__checkmark4"></span>
</span>
</label>



Issue: Error: ngRepeat:dupes Duplicate Key in Repeater

Answer

Try to add a track in your ng-repeat:

<label class="concentration-label3" ng-repeat="subject in subjects track by $index">