javascript - how to append active color to the li element on filtering? -
i want append active class li element based on filtering in angular,i tried ng-class iam not getting.
here html code:
<div class="input-group dropdown" style="margin-top:50px;margin- left:100px;"> <input type="text" class="form-control" ng-model="input.val" data-toggle="dropdown" aria-describedby="basic-addon2" ng-change="fnautocompletequestion(input.val)" > <div class="dropdown-menu width-menu"> <ul style="width: 225px; height: auto; overflow: auto; list-style-type: none;margin-left: -30px;"> <li ng-repeat="value in data | filter: input.val" ng-class="{'active': $index == value.txt} ng-click="input.val=value.txt"> {{value.txt}} <hr ng-show="!$last" style="margin-top: -1px; margin-bottom: 12px;"> </li> </ul> </div>
css
.active{ color:red; }
any appreciated.
i think missing ''
ng-class="{'active': $index == input.val}
Comments
Post a Comment