Я ищу фильтр с несколькими состояниями angularjs, подобный this arr in array | filter:filters.search | filter:{company: selectedName} | filter:{voucher_type: both }
this arr in array | filter:filters.search | filter:{company: selectedName} | filter:{voucher_type: both }
this arr in array | filter:filters.search | filter:{company: selectedName} | filter:{voucher_type: both }
Он работает, но не фильтрует все условия, вставляя здесь полный код. filter:{company: selectedName} | filter:{voucher_type: both }
filter:{company: selectedName} | filter:{voucher_type: both }
этот шаг фильтра ошибочен в моем коде. @ Спасибо за ответ
<html > <head> <link rel="stylesheet" type="text/css" href="css/bootstrap.min.css"/> <title>search</title> </head> <body> <div ng-app="app" ng-controller="mainCtrl"> <div><select ng-model="selectedName" ng-options="x for x in names"> </select> </div> <input type="text" ng-model="both"> <div>Search by Name: <input type="text" ng-model="filters.search"></div> <div ng-repeat="arr in array | filter:filters.search | filter:{company: selectedName} | filter:{voucher_type: both } "> <span ng-bind="arr.name"></span> </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('app', []); app.controller('mainCtrl', function($scope) { $scope.names = ["x", "y"]; $scope.filters = { x: false, company: '', search: '' }; $scope.actions = { updateyCompany: function () { if($scope.filters.y) { $scope.filters.company = 'y'; } else { $scope.filters.company = ''; } } }; $scope.both ="z"; $scope.array = [ {name: 'Tobias', lname: 'TLname', company: 'x'}, {name: 'Jeff', lname: 'JLname', company: 'x'}, {name: 'Brian', lname: 'BLname', company: 'x'}, {name: 'Igor', lname: 'ILname', company: 'y'}, {name: 'James', lname: 'JLname', company: 'z'}, {name: 'Brad', lname: 'BLname', company: 'y'}, {name: 'Basil', lname: 'Basil', company: 'z'}, ]; }); </script> </body> </html>