javascript - Angular : use filter on ng-options when using for(key,value) -
i have listbox want filter depending on user input, in order display "matches" posibility.
unfortunatly, "filter" change value display or don't work @ all. expect it's because use (key,value) , have different behaviour ?
<p>filter : <input type="text" ng-model="filterattr"/> {{filterattr}}</p> <select ng-options="value (value.attr+ ' : ' +value.otherattr) (key,value) in customlist | filter:{attr:filterattr}" size="4" ng-model="nevermind" ng-change="changesensor(tyredetails)"> </select>
here jsffidle : http://jsfiddle.net/hlywvam7/2/
thank help.
in angular filters can applied arrays, not objects.
now either change "customlist" format array or convert "customlist" object array below
$scope.filtercustomlist = function(items) { var result = []; angular.foreach(items, function(value, key) { result[key] = value; }); return result; }
Comments
Post a Comment