1
我怎么能告诉角是角增加了我的CSS类时数为更大然后14和较小然后20角纳克级(参数2间)
我现在有这样的事情。
ng-class="{ day_yellow: weatherList.temp.max >= 15, }">
我怎么能告诉角是角增加了我的CSS类时数为更大然后14和较小然后20角纳克级(参数2间)
我现在有这样的事情。
ng-class="{ day_yellow: weatherList.temp.max >= 15, }">
您可以使用简单的& &条件:
ng-class="{ day_yellow: weatherList.temp.max >= 15 && weatherList.temp.max < 20 }">
这是最通用的解决方案:
ng-class="{true: 'day_yellow', false: 'some_other_class'}[weatherList.temp.max < 20 && weatherList.temp.max > 14]
如果您只需要在条件为真CSS类,你可以用这个:
ng-class="{'day_yellow': weatherList.temp.max < 20 && weatherList.temp.max > 14}
另一种方式是将条件放到你的控制器,然后在HTML中只使用变量:
控制器
$scope.condition = weatherList.temp.max < 20 && weatherList.temp.max > 14;
HTML
ng-class="{'day_yellow': condition}
此作品完美的感谢! :) –
不客气;) –