Reputation: 21
Why is the ng-repeat not working with the given data? I know it has something to do with the view loaded before the data or something. But I fill the selectedCourses array based on the users input, and the view shows that the Array is populated, but the ng-repeat div DOES NOTHING! please help.
<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">
So the HTML should be repeating the information in the selectedCourses array as h3 headers, but it show nothing! Check out this picture
Do I need to do something to reload the ng-repeat section of the view?
Upvotes: 0
Views: 70
Reputation: 575
It's because you have the duplicate in your array("ENGR 170 (31237)" as i see on the picture), try to use track by $index
ng-repeat="selCourse in selectedCourses track by $index"
Upvotes: 4