我已经内置了Btn风格,所以我只想将它自定义为
的新风格<style>
.btn.activeother {
color: #fff;
background-color:Red;
}
</style>
并希望像这样使用它
<div class="btn-group col-md-10 segmented-label" >
<label ng-repeat="list in inputarray" name="{{assessmenttype}}"
ng-model="$parent.selecteditem" ng-class="{'btn activeother':selecteditem==list.score && selecteditem!= normalscore }" btn-radio="{{list.score}}">{{list.name}}</label>
</div>
所以在这里我将normalscore
传递为2,我有3个项目,每个项目包含列表分数1,2,3,列表名称为a,b,c
所以我希望使用ng-class设置我的服装css类.btn.activeother
使用逻辑,如果选择的项目分数与正常相同,我想要应用.btn.activeother而不是默认的btn active
所以请帮我解决这个问题 目前我的ng-class没有处理这个请告诉我什么是正确的?
答案 0 :(得分:1)
初始定义了类.btn
并仅对.activeother
类
<div class="btn-group col-md-10 segmented-label" >
<label ng-repeat="list in inputarray" name="{{assessmenttype}}"
ng-model="$parent.selecteditem" class="btn" ng-class="{'activeother':selecteditem ==list.score && selecteditem != normalscore }" btn-radio="{{list.score}}">{{list.name}}</label>
</div>