Autocomplete text box not working in ng repeat. If i type on text box then name is getting but not selecting into autocomplete t | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Autocomplete text box not working in ng repeat. If i type on text box then name is getting but not selecting into autocomplete t

<tr id='addr{{$index}}' ng-repeat="items in calories track by $index"> <td style="border:none;border:0px;"> <div class="input-group" style="width:320px;"> <span class="input-group-addon"><i class="fa fa-cutlery" style="font-size:20px;"></i></span> <!--<input id="email" type="text" class="form-control" name="email" placeholder="Food Ingediants">--> <input type="text" ng-model="item" ng-keyup="complete(item)" class="form-control" /> <span class="list-group-item" ng-repeat="data in filterItem" ng-click="fillTextbox(data,$index)">{{data.ItemsName}}</span> </div> </td> </tr> <script> $scope.complete = function (string) { var output = []; angular.forEach($scope.itemList, function (item) { console.log('item', item.ItemsName, string); if (item.ItemsName.toString().toLowerCase().indexOf(string.toString().toLowerCase()) >= 0) { output.push(item); } }); $scope.filterItem = output; } $scope.fillTextbox = function (string,index) { console.log('string>>>>>>>>>>>>>>>>>>>', string,index); $scope.ItemsName = string.ItemsName; $scope.filterItem = null; } </script>

11th Jun 2018, 10:48 AM
Mayank Bhushan
1 Answer
0
I want answer.
12th Jun 2018, 5:50 AM
Mayank Bhushan