0
我有一個按鈕範圍與2個按鈕,我想,當用戶點擊其中之一,ng-class按鈕活動時添加類(我的兩個視圖顯示的ng-show /隱藏)。吳級 - 活動/非活動按鈕
我有測試這一點,但它不工作:
HTML:
<div class="button-bar">
<a class="button btn-transpr-left" ng-class="{'activ-btn': isActive1}" ng-click="firstStep()">Acceptées</a>
<a class="button btn-transpr-right" ng-class="{'activ-btn': isActive2}" ng-click="nextStep()">En attente</a>
</div>
CSS:
.activ-btn {
border-bottom: 3px solid !important;
font-weight: bolder !important;
}
JS:
$scope.isActive2 = false;
$scope.isActive1 = true;
$scope.nextStep = function() {
$scope.data.step += 1;
$scope.isActive1 = $scope.isActive1;
$scope.isActive2 = !$scope.isActive2;
}
$scope.firstStep = function() {
$scope.data.step = 1;
$scope.isActive1 = !$scope.isActive1;
$scope.isActive2 = $scope.isActive2;
}
也許我做錯誤...有人可以幫助我嗎?
謝謝所有人!
解釋什麼是行不通的 - 班級沒有加入嗎? CSS不工作?請提供更多詳情 –
只有第一個按鈕才能應用該類,但點擊時,什麼也沒有發生...... – PositivProd