example/app.js
function(criteria) {
          var results = [];

          criteria = angular.isArray(criteria) ? criteria : [criteria];

          // Search through each
          criteria.forEach(function(q) {
            if(q && q !== '') {

              _listing.forEach(function(item) {
                for(var name in item) {
                  if(item[name].toLowerCase().indexOf(q.toLowerCase()) !== -1 && results.indexOf(item) === -1) {
                    results.push(item);
                  }
                }
              });
            }
          });

          return $q.when(results);
        }
function(criteria) {
          var results = [];

          criteria = angular.isArray(criteria) ? criteria : [criteria];

          // Search through each
          criteria.forEach(function(q) {
            if(q && q !== '') {

              _listing.forEach(function(item) {
                for(var name in item) {
                  if(item[name].toLowerCase().indexOf(q.toLowerCase()) !== -1 && results.indexOf(item) === -1) {
                    results.push(item);
                  }
                }
              });
            }
          });

          return $q.when(results);
        }
function ( criteria ) { var results = [ ] ; criteria = angular . isArray ( criteria ) ? criteria : [ criteria ] ; // Search through each criteria . forEach ( function ( q ) { if ( q && q !== '' ) { _listing . forEach ( function ( item ) { for ( var name in item ) { if ( item [ name ] . toLowerCase ( ) . indexOf ( q . toLowerCase ( ) ) !== - 1 && results . indexOf ( item ) === - 1 ) { results . push ( item ) ; } } } ) ; } } ) ; return $q . when ( results ) ; }
Search for a product
Search for a product