How to dynamically change css values (like color in whole app) etc

后端 未结 4 1970
孤独总比滥情好
孤独总比滥情好 2021-02-12 15:39

I have one question...

If you want conditional styling: you must use ng-class or ng-style construction.

But...

For example: I\'

4条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-02-12 16:10

    The easiest way I can think about is, for example, clicking on myBox changes its background-color.

    html:

    js:

    $scope.changeBackgroundColor = function(){
      angular.element('.myBox').css('background-color', '#000');
    }
    

    css:

    .myBox{background-color: #fff;}
    

    Hope I've been helpfull.

提交回复
热议问题