当没有重复时,重复重复问题

时间:2016-09-11 13:20:50

标签: javascript angularjs angularjs-ng-repeat

$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>
  

问题:错误:ngRepeat:dupes Repeater中的重复键

1 个答案:

答案 0 :(得分:1)

尝试在ng-repeat中添加曲目:

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