1

I try to filter two values like this | filter:{voucher_type: selectedName } | filter:{voucher_type: both }

Here both is "B" and selectedName "P or R". Below code work only one filter only.

I want to combine this two filter values together and show the result like 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>

Find my demo project here https://jsfiddle.net/basilbkodakk/sk549x4m/2/ .there have 3 company x,y,z .list box show x and y . z is common for x,y .that filter method in angularjs

4
  • Please put your code in a fiddle to make it easy to understand and get better answers. Commented Aug 31, 2016 at 6:18
  • You can't do that. The second filter gets the result of the first. You can create your own filter or filter in a function in the controller and use this function like for c in getProducts() Commented Aug 31, 2016 at 6:21
  • Thank @ mJunaidSalaat am update fiddle code soon Commented Aug 31, 2016 at 7:18
  • Hai everyone my update code is here jsfiddle.net/basilbkodakk/sk549x4m/2 am miss db file in old code . now am creat array . that have drop down box showing my company x,y,z in z company . if am select x it show the result in x and z that am want .. thank you Commented Aug 31, 2016 at 7:34

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.