I have an application built with AngularJs.
Html file contain information like that:
<div>
<h3 ng-if="..."></h3>
<h3 ng-if="..."></h3>
<h3 ng-if="..."></h3>
<h3 ng-if="..."></h3>
</div>
So on website I can have 4 different elements. If I have just two of then I want to use different classes then with 4 of them.
if(myVar == 0){
$scope.life_class='';
}else if(myVar ==1){
$scope.life_class='doscol';
}else if(myVar ==2){
$scope.life_class='tricol';
}else if(myVar ==3){
$scope.life_class='foucol';
}else{
$scope.life_class='fifcol';
}
And with 'foucol' and 'fifcol' classes I want to add another class, but only in case that 'foucol' and 'fifcol' are in use.
I tried many times with different solutions like that:
if(active_date_count >= 2) {
document.getElementById("h3").foucol += " font_class";
document.getElementById("h3").tricol += " font_class";
}
But it does't work properly. Any ideas? Thanks in advance