Click here to Skip to main content
15,885,985 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hello I want to change the color of the background of textarea with angular. I use the code below. I want to change the color when I select it. And when I choose it falls into this field, the color becomes red. But the color does not change in the interface.How to show interface change color?

What I have tried:

app.controller("myTextArea", function($scope) {
    $scope.myAreas = {
        "color" : "black",
        "background-color" : "red",
        "font-size" : "30px",
        "padding" : "100px"
    }
});
Posted
Updated 30-Jul-20 16:59pm
v2

1 solution

You can achieve this using css itself.

For changing the color of textarea control (input), something like below:

CSS
.mat-form-field-empty.mat-form-field-label {
    color: green;
}

For changing the underline-color when it's highlighted-
CSS
.mat-form-field-underline {
    background-color: red;
}

Add this in styles.scss (or styles.css).

Alternatively, you can make use of themes: Angular Material UI component library[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900