Angular 通过 ng class 设置 CSS 的活动选择器
Angular set :active selector of CSS by ng class
我想通过 ng-class 设置 className:active 选择器,如下所示:
ng-class='{"className:active" : true}'
试试这个:
ng-class="{'active':true}"
对于变量你可以试试
<!-- add a class to the first item -->
<ul>
<li ng-class="{ 'text-success': $first }" ng-repeat="item in items">{{ item.name }}</li>
</ul>
<!-- add a class to the last item -->
<ul>
<li ng-class="{ 'text-danger': $last }" ng-repeat="item in items">{{ item.name }}</li>
</ul>
<!-- add a class to the even items and a different class to the odd items -->
<ul>
<li ng-class="{ 'text-info': $even, 'text-danger': $odd }" ng-repeat="item in items">{{ item.name }}</li>
</ul>
for more options
我猜你必须通过创建 class 来 "fake" 它,它具有与你的 :active 伪 class.
完全相同的属性
我想通过 ng-class 设置 className:active 选择器,如下所示:
ng-class='{"className:active" : true}'
试试这个:
ng-class="{'active':true}"
对于变量你可以试试
<!-- add a class to the first item -->
<ul>
<li ng-class="{ 'text-success': $first }" ng-repeat="item in items">{{ item.name }}</li>
</ul>
<!-- add a class to the last item -->
<ul>
<li ng-class="{ 'text-danger': $last }" ng-repeat="item in items">{{ item.name }}</li>
</ul>
<!-- add a class to the even items and a different class to the odd items -->
<ul>
<li ng-class="{ 'text-info': $even, 'text-danger': $odd }" ng-repeat="item in items">{{ item.name }}</li>
</ul>
for more options
我猜你必须通过创建 class 来 "fake" 它,它具有与你的 :active 伪 class.
完全相同的属性