Reputation: 5485
What is wrong in this:
jsfiddle.net/TTY4L/3/
I am trying to make a filter kind of list, when i enter some value, say 'avi', it should list like
I know the logic to do So, {{['Avi','Ravi','Raj','Raghuram'] | filter:'avi'}}, But i could not able to get, how to put this in controller, and display from there, Can i use $filter for this, If yes, then how can i.
Upvotes: 0
Views: 95
Reputation: 19588
You can inject the filter into the controller like this.
function MyCtrl($scope, $filter){
$scope.names = $filter('filter')('searchText');
}
Upvotes: 0
Reputation: 4351
try this:
<li ng-repeat="searchItem in searchItems | filter:searchFilter">{{searchItem}}</li>
abd here the fiddle
Upvotes: 1
Reputation: 7079
You could do something like this in your ng-repeat
<li ng-repeat="searchItem in searchItems|filter:searchFilter:strict">{{searchItem}}</li>
Upvotes: 0