Thank you everyone. I still don’t know how to solve yesterday’s problem. I don’t know why. Finally I changed the writing method and solved it using class="{{all_font_color_}}"this method
I feel like you should write like this: ng-class="{true:'active',false:'inactive'}[tabVal==2]" The meaning of the above expression is: by judging whether 'tabVal' is equal to 2, To determine the style value of ng-class; If tabVal==2 is true, then ng-class='active'; where tabVal can be defined in the controller and can be a variable; active is any class name;
Thank you everyone. I still don’t know how to solve yesterday’s problem. I don’t know why.
Finally I changed the writing method and solved it using
class="{{all_font_color_}}"
this methodYou posted the entire code of ng-class. You can’t see it on the right side. I wonder if there is something wrong with your format
Determine whether the class exists
Make sure the class style is not overwritten
You can test it in plnkr
I feel like you should write like this:
ng-class="{true:'active',false:'inactive'}[tabVal==2]"
The meaning of the above expression is: by judging whether 'tabVal' is equal to 2, To determine the style value of ng-class;
If tabVal==2 is true, then ng-class='active';
where tabVal can be defined in the controller and can be a variable;
active is any class name;