2
ID를 개체에 매핑하는 개체가 있습니다. 이 개체의 목록을 표시하고 필터를 사용하고 싶습니다. 그러나 작동시키지 못합니다. 특히, 내가 여기에 옵션에 표시 ID 2 오브젝트를 방지 노력하고있어 내가있어 무엇 : http://jsfiddle.net/9d2Za/NG 옵션의 필터가 작동하지 않습니다.
<div ng-app ng-controller="ctrl">
Unfiltered:
<select ng-model="selectedBidType"
ng-options="bidType.id as bidType.label for (bidTypeID, bidType) in bidTypes">
</select>
<br>
Filtered:
<select ng-model="selectedBidType"
ng-options="bidType.id as bidType.label for (bidTypeID, bidType) in bidTypes | filter:{id: '!2'}">
</select>
</div>
는 참고 : 나는 우리가 와서 어떤 수정의 bidTypes
객체의 구조를 변경할 수 없습니다 와 함께. 여기 내 AngularJS와있어 다음과 같이하여 documentation
function ctrl($scope)
{
$scope.selectedBidType = 1;
// Bid type objects are indexed by ID for fast lookup (this cannot be changed in solution)
$scope.bidTypes = {
1: {id: 1, label: "Buy"},
2: {id: 2, label: "Sell"},
3: {id: 3, label: "Missing"}
};
}
을 내가 어떻게 필터에 지정할 수있는 두 가지 요소를 제거하려면? ? 필터를 시도 : {id : '! 2'! 3 '}하지만 작동하지 않습니다 – forgottofly
@MANOJ [이 질문은 도움이 될 수 있습니다] (http://stackoverflow.com/questions/15868248/how-to-filter- 다중 값 또는 연산에서). – Blackhole