I am struggling to identify records within $scope.employees
that do not have a corresponding record in $scope.allEmployeeGroups
. The filter does not seem to be working correctly, as it is returning all records instead of just a few unmatched ones. Despite knowing that there should only be a few mismatches, the result includes all records. In each case, the indexOf value is -1 when I expected it to be different. I am unable to pinpoint what mistake I am making. Below is the code I am using:
function getNonGroupEmployees() {
var arr = $scope.employees.filter(function (item) {
return $scope.allEmployeeGroups.indexOf(item.EmployeeId) === -1;
})
return arr;
}
Employee Object:
public System.Guid EmployeeId { get; set; }
public Nullable<System.Guid> SiteId { get; set; }
// Other properties related to employee...
Group Object:
public Guid EmployeeGroupId { get; set; }
public Guid SiteId { get; set; }
// Other properties related to group...
I would greatly appreciate any help or guidance on this matter.