javascript - Angular JS, search/filter by many fields on input -
i trying implement code found application : http://jsfiddle.net/8peax/42/
with no success. demo works on site if ammend suit app gives error when searching 'angular.lowercase(...).indexof not function'
please see sample code below:
html:
<p><label>filter</label><input data-ng-model="phonefilter.$" type="text"> </p> <ul> <li data-ng-repeat="customer in customers | filter:phonefilter:multiplechoicescomparator"> {{customer.name }} {{customer.lastname}} </li> </ul> </p>
controller:
var customercontroller = function ($scope, customerservice, $log, $routeparams, $location, $sce) { var customer = function (data) { $scope.customer = data; $log.info(data); }; $scope.multiplechoicescomparator = function (expected, actualincompactform) { var listactual = actualincompactform.split(' '); var mustbeincluded = false; angular.foreach(listactual, function (actual) { if (angular.lowercase(expected).indexof(angular.lowercase(actual)) !== -1) { mustbeincluded = true; } }); return mustbeincluded; };
can assist. example seems search random input in order , produce results. add src html cater new function?
Comments
Post a Comment