我有以下用于创建标签的代码
<ul ng-init="tab = 1" class="nav nav-tabs" role="tablist" style="margin-top:10px;">
<li class="active"><a ng-click="tab = 1">1. Shopping cart</a></li>
<li><a ng-click="tab = 2">2. Delivery Address</a></li>
<li><a ng-click="tab = 3">3. Place Order</a></li>
</ul>
第一个标签处于有效状态,如下所示。
但是当我选择第二,第三个标签时,它没有激活。如何激活所选选项卡并使其全部处于非活动状态。
答案 0 :(得分:0)
<ul ng-init="tab = 1" class="nav nav-tabs nav-justified" role="tablist" style="margin-top:10px;">
<li ng-class="{active:tab==1}"><a data-toggle="tab" ng-click="tab = 1">1. Shopping cart</a></li>
<li ng-class="{active:tab==2}"><a data-toggle="tab" ng-click="tab = 2">2. Delivery Address</a></li>
<li ng-class="{active:tab==3}"><a data-toggle="tab" ng-click="tab = 3">3. Place Order</a></li>
</ul>