Несколько фильтров в одной функции, используя angularjs

Я пытаюсь отфильтровать два значения, как это | filter:{voucher_type: selectedName } | filter:{voucher_type: both }

Здесь оба «B» и selectedName «P или R». Ниже кода работает только один фильтр.

Я хочу объединить эти два значения фильтра вместе и показать результат как voucher_type B + P (Or) R.

<html>
<head>
<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css"/>
<title>search</title>
</head>
<body>
<div class="row">
<div class="container">
<div class="col-sm-9">
<div ng-app="myApp">
<script type="text/ng-template" id="search">
<a>
<span bind-html-unsafe="match.label | typeaheadHighlight:query"></span>
<i> {{match.model.sub_name}} -({{match.model.group_name}}) </i>
</a>
</script>
<form class="form-search" ng-controller="autocompleteController">
Selected Ledger: {{selectedLedgers}} <br>
<br>
<!--          typeahead="c as c.ledger_id + '-' + c.ledger_name + ' <i>(' +c.group_name + ')</i>'-->
<input type="text" ng-model="both"></p>
<div>select voucher :<select ng-model="selectedName" ng-options="x for x in names">
</select>
</diV>
<input type="text" ng-model="selectedLedgers" placeholder="Search Ledger" typeahead="c as c.ledger_id +  '-'+ c.ledger_name for c in producers | filter:$viewValue| limitTo:20 | filter:{voucher_type: selectedName1 } | filter:{voucher_type: both }" typeahead-min-length='2' typeahead-on-select='onSelectPart($item, $model, $label)' typeahead-template-url="search" class="form-control" style="width:350px;">
<i class="icon-search nav-search-icon"></i>
</form>
</div>
</div>
</div>
</div>
<script type="text/javascript" src="js/angular.min.js"></script>
<script src="js/ui-bootstrap-tpls-0.9.0.js"></script>
<script type="text/javascript">
var app = angular.module('myApp', ['ui.bootstrap']);

app.controller('autocompleteController', function($scope, $http) {

$http.get("getLedgers.php").success(function(data){
$scope.producers = data;
});

$scope.names = ["P", "R"];
$scope.filters = {
x: false,
company: '',
search: ''
};
$scope.both ='B';

});
</script>
</body>
</html>

Найти мой демо-проект здесь https://jsfiddle.net/basilbkodakk/sk549x4m/2/ .там есть 3 компании x, y, z. list box показывают x и y. z является общим для x, y. метода фильтрации в angularjs

1

Решение

Задача ещё не решена.

Другие решения

Других решений пока нет …

По вопросам рекламы ammmcru@yandex.ru
Adblock
detector