3

form.html

<md-button class="md-raised md-primary pull-right formPage" ng-disabled="formPage.$invalid" ng-click ="submit()">SAVE</md-button>

css

.md-button.md-raised.md-primary.formPage {
    position: right !important;
    color: #FFFFFF;
    background-color:#008cba;    
}

Button is disabled but it has custom color from my css. How can i show the default disable style or maybe change button color if it is disable ?

Jsfiddle

3 Answers 3

9

the css should be

.md-button.md-raised.md-primary.formPage:not([disabled])

see http://jsfiddle.net/apxbutmf/

Sign up to request clarification or add additional context in comments.

1 Comment

I thought about this logic, but couldn't find out how can i add color when it is not disabled. Thanks a lot for your help.
0

When the button is disabled a new class comes up to your button with name called like disabled. Check it and update your css as below.

.md-button.md-raised.md-primary.formPage:not(.disabledclassname) {
    position: right !important;
    color: #FFFFFF;
    background-color:#008cba;    
}

1 Comment

That didn't work. I have updated the question with Fiddle.
0

Overriding following css class worked for me (Angular-Material v12 Button mat-stroked):

.mat-stroked-button.mat-button-disabled.mat-button-disabled {    

color: #FFFFFF;
background-color: #008cba

}

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.