のレコードが$scope.allEmployeeGroups
に一致するレコードを検索しようとしていますが、フィルタがレコードをフィルタリングしていないと確信していますが、すべてのレコードを返します。各レコードについて、indexOf == -1とすれば、それはすべきではないことが分かっています。私は何が間違っているのか分かりません。ここに私のコードは次のとおりです。フィルタはレコードをフィルタリングしていません
function getNonGroupEmployees() {
var arr = $scope.employees.filter(function (item) {
return $scope.allEmployeeGroups.indexOf(item.EmployeeId) === -1;
})
return arr;
}
Employeeオブジェクト:
public System.Guid EmployeeId { get; set; }
public Nullable<System.Guid> SiteId { get; set; }
public string SiteName { get; set; }
public string DisplayName { get; set; }
public string FirstName { get; set; }
public string MiddleName { get; set; }
public string LastName { get; set; }
public string Suffix { get; set; }
public string Alias { get; set; }
public Nullable<System.DateTime> DOB { get; set; }
public string SsnLastFour { get; set; }
public string Email { get; set; }
public string UserName { get; set; }
public string Password { get; set; }
public bool IsActive { get; set; }
public bool IsLoginEnabled { get; set; }
public Nullable<System.DateTime> LastLogin { get; set; }
public Nullable<System.Guid> SignatureTypeId { get; set; }
public string SignatureType { get; set; }
public string NumberHome { get; set; }
public string NumberCell { get; set; }
public bool IsSuperUser { get; set; }
public bool IsDeleted { get; set; }
public System.DateTime Created { get; set; }
public System.DateTime LastModified { get; set; }
public Nullable<System.Guid> ModifiedByEmployeeId { get; set; }
public string ApiKey { get; set; }
グループオブジェクト:
public Guid EmployeeGroupId { get; set; }
public Guid SiteId { get; set; }
public Guid EmployeeId { get; set; }
public Guid SiteGroupId { get; set; }
public bool IsDeleted { get; set; }
public DateTime Created { get; set; }
public DateTime LastModified { get; set; }
public Guid? ModifiedByEmployeeId { get; set; }
public string SiteName { get; set; }
public string EmployeeName { get; set; }
public string SiteGroupName { get; set; }
public string ModifiedByEmployeeName { get; set; }
どのような援助が大幅に高く評価されます。
感謝。残念ながら、上記のコードはエラーをスローします。 –
$ scope.allEmployeeGroupsリストに$ scope.employeesと同じ型オブジェクトが含まれていますか? – Syedur
いいえ。オブジェクトが異なります。彼らが共有する唯一のものはEmployeeIdフィールドです。 –