How to change CSS when it's ng-disabled?

后端 未结 2 1553
北海茫月
北海茫月 2021-02-12 08:24

I have this button:



        
2条回答
  •  一整个雨季
    2021-02-12 08:38

    What Toress answered should work fine but you don't need the help of AngularJS here at all (a native implementation & usage is always best).

    You can make use of CSS3 since you already have a class on it. Example:

    input.save-changes {
        /* some style when the element is active */
    }
    
    input.save-changes[disabled] {
        /* styles when the element is disabled */
        background-color: #ffffd;
    }
    

    Edit: You can immediately test it on this page of StackOverflow. Just inspect the blue button element and put the disabled attribute and see it's CSS.

    .save-changes {
      background-color: red;
      padding: 7px 13px;
      color: white;
      border: 1px solid red;
      font-weight: bold;
    }
    .save-changes[disabled] {
      background-color: #FF85A1
    }
    
    
    

提交回复
热议问题