我想基于Angular中的过滤为li元素添加活动类,我尝试使用ng-class但是我没有得到。
这是我的HTML代码:
test := make(chan int, 5)
test <- 1
test <- 2
CSS:
<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>
</div>
答案 0 :(得分:0)
我认为你错过了''
ng-class="{'active': $index == input.val}
答案 1 :(得分:0)
React.createElement('div', {className: 'test', 'data-test': 'some value'});