ng-repeat 没有显示信息

ng-repeat not showing information

为什么 ng-repeat 不能处理给定的数据?我知道这与在数据之前加载的视图或其他内容有关。但是我根据用户输入填充了 selectedCourses 数组,视图显示该数组已填充,但 ng-repeat div 什么都不做!请帮忙。

<br />
  Matches {{ matches }}

  <br />
  hits {{ hits }}

  <br />
  selected Courses: {{selectedCourses}} 
  <br />

  <div ng-repeat = "selCourse in selectedCourses" >
    <h3> {{selCourse}}  </h3>
  </div>

<br />
<label class="control-label">Search Class to Add </label>
 <input placeholder = "Enter a class" ng-model = "courseInput" type="text" class="form-control" id="courseInput">

因此 HTML 应该将 selectedCourses 数组中的信息重复为 h3 headers,但它什么也没显示! Check out this picture

是否需要重新加载视图的 ng-repeat 部分?

这是因为你的数组中有重复项("ENGR 170 (31237)" 如图所示),尝试使用 track by $index

ng-repeat="selCourse in selectedCourses track by $index"