The problem is that you push the same items many times into $scope.selectedCourses, which results into an error (because of duplicate values in ngRepeated items) which in turn causes the view to not be updated.
To prevent adding the same item many time, you should check if it is already present in the array:
$scop.checkplanneddetails = function (course) {
...
for (var k = 0; k < $scope.planneddetails.length; k++) {
if ($scope.requirementcoursename==$scope.planneddetails[k].course_name) {
if (!$scope.checkcoursefunction($scope.selectedCourses, course)) {
// ONLY add the course if it is NOT already present
$scope.selectedCourses.push(course);
}
course.checked = true;
return true;
}
}
return false;
};
There is also a problem with using ng-checked="checkplanneddetails(child), because checkplanneddetails is not idempotent. You should not use it with ngChecked, because it is run every time a $digest cycle takes place.
You should ngInit instead and also make sure you add course.checked = true at the proper place inside checkplanneddetails (see above):
<!-- Change that: -->
<input type="checkbox" ng-checked="checkplanneddetails(child)" ... />
<!-- To this: -->
<input type="checkbox" ng-init="checkplanneddetails(child)" ... />
See, also, this short demo.