angularjs - Using text input as filter option -
i struggle usage of filter. have input field want use filter option.
the array looks this:
$scope.examples=[ { name:'dolly', place:'roof', description:'dolly friend of mike.' }, { name:'mike', place:'cellar', decription:'mike doesn't roof.' },]; $scope.search="";
the input:
<input ng-model="search" type="text" placeholder="type here">
and ng-repeat:
<tr ng-repeat="something in examples |filter:search"> {{something.name}} </tr>
now, if type in "dolly", shows me dolly quite planned. if type in "mike" output dolly , mike, because used word mike in description dolly. same typing in "roof". tried use
<ng-repeat="something in examples |filter:{name:'search'}">
but in case don't work , there no output. want restrict filter 'name' only. maybe have suggestion how make work.
i'm thankful every advice.
if write {name:'search'} instead of {name:search}, means keep string contains 'search' string
try :
<ng-repeat="something in examples |filter:{name:search}">
Comments
Post a Comment