1
제품 배열이 있습니다 .i 형식 키를 필터링하려고합니다. 나는 야채와 과일 만 함께 보여주고 싶다. 각도 키의 단일 키와 다중 값에 필터를 설정하는 방법.하나의 키를 여러 개의 값으로 필터링하기
<div ng-controller="MyCtrl">
<ul>
<li ng-repeat="item in products | filter:({type:'vegetable'}||{type:'fruit'})">{{item.name}}</li>
</ul>
</div>
var myApp = angular.module('myApp', []);
function MyCtrl($scope) {
$scope.products = [
{name:"Apple",type:"fruit"},
{name:"Grape",type:"fruit"},
{name:"Orage",type:"fruit"},
{name:"Carrot",type:"vegetable"},
{name:"Milk",type:"dairy"}
]
}
감사하지만 우리는 밖으로 작성하여이 작업을 수행 할 수 있습니다 맞춤 필터? – user3398632
제 이해는 아니오입니다. 다음과 같은 답변으로 몇 가지 질문이 있습니다. http://stackoverflow.com/questions/21987904/angular-js-ng-repeat-filter-by-property-having-one-of-multiple-values- or-of-val –
ok @wayneEllery 감사합니다. – user3398632