angular.js - angularjs ng-class issue
高洛峰
高洛峰 2017-05-15 16:59:50
0
4
537

Why is this all_font_color not taking effect?

allFontColor in scope is indeed true

高洛峰
高洛峰

拥有18年软件开发和IT教学经验。曾任多家上市公司技术总监、架构师、项目经理、高级软件工程师等职务。 网络人气名人讲师,...

reply all(4)
大家讲道理

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

巴扎黑

You 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

PHPzhong
  1. Determine whether the class exists

  2. Make sure the class style is not overwritten

You can test it in plnkr

phpcn_u1582

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;

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template