I am using Angular 6 and I have a simple div and want to set the background color of this div from inside the template. This works fine when passin
You can do it in 2 ways
use pipe that get a string and return some color code code.
add to the html tag a dynamic class for example:
and in the scss add the options
scss:
.my-div{
&.optoin1{
background-color:red;
}
&.optoin2{
background-color:black;
}
&.optoin3{
background-color:green;
}
&.optoin4{
background-color:yellow;
}
}