有没有办法给予'重要# 39;到控制器中的CSS属性

Is there any way to give ' important' to css property in controller

本文关键字:控制器 属性 CSS 重要 有没有      更新时间:2023-09-26

我的查询是'important' on 'color'在这里不起作用。在控制器上给CSS属性"重要"的方法是什么?我想重写bootstrap内置属性,并想用controller重写它。

 $scope.red = function () {
      console.log("red");
      $scope.re = {
          'background-color': 'red',
          'color': {
          'black'
          '!important'
      };
 };

!important添加到与color相同的字符串中

$scope.red = function () {
   console.log("red");
   $scope.re = {
      'background-color': 'red',
      'color': 'black !important';
   }
}

'black !important'是一个值

try this

$scope.re = {
                'background-color': 'red',
                'color': {
                    'black !important'
                };
            }