förschter
förschter

Reputation: 860

Change colors for AngularJS Material in CSS?

I have tried to change the color of the text in input in AngularJS Material with CSS but somehow haven't got it to work. What am I doing wrong?

This is my input field:

<md-input-container>
        <label>Title</label>
        <input ng-model="user.title">
</md-input-container>

and this is how I have tried to change the color of the text.

<md-input-container style='color:#e52973'>
        <label>Title</label>
        <input style='color:#e52973' ng-model="user.title">
</md-input-container>

Upvotes: 2

Views: 184

Answers (1)

Vikasdeep Singh
Vikasdeep Singh

Reputation: 21766

You need to use !important with your style attributes to override defaults.

Also you just need to apply style on input not to md-input-container to change color of input text.

So your current code:

<md-input-container style='color:#e52973'>
        <label>Title</label>
        <input style='color:#e52973' ng-model="user.title">
</md-input-container>

Change to:

<md-input-container>
        <label>Title</label>
        <input style='color:#e52973 !important' ng-model="user.title">
</md-input-container>

Working codepen example: https://codepen.io/anon/pen/VxrjEx

Upvotes: 2

Related Questions