2016-10-04 102 views
1

我有這樣一個過濾器:篩選產生錯誤的結果Angularjs

$scope.Approved = $filter('filter')($scope.Summary.CorpEmployees, { locationId: item.Label, evaluationStatusId: '3' }); 

出於某種原因,過濾器是拉動其evaluationStatusId = 13記錄。 有人可以解釋爲什麼會發生這種情況嗎? 我怎樣才能確保我的過濾器拉只有那些記錄evaluationStatusId = 3

+0

您使用一個字符串,使用一些 –

+0

我試過數量也但結果是一樣的。 –

+0

爲什麼downvote?這個問題有什麼問題。 –

回答

2

按我的評論:

你有 的angularjs文檔使用所謂的「比較」嚴格平等參數,否則做一個「包含」而不是一個 「等於」的過濾器。

See angular docs for filter here

它應該是這樣的:

$scope.Approved = $filter('filter')(
    $scope.Summary.CorpEmployees, 
    { locationId: item.Label, evaluationStatusId: '3' }, 
    true // <--- This is the parameter that forces strict equality 
);