Answer the question
In order to leave comments, you need to log in
How to write dynamic styles in Angular 2?
The idea is to have the styles depend on the js variables, but not overload the html with inline styles.
For example, we need a standard color around which the design of other components dances. In less we can put that color into a variable and then use some simple math to calculate the color deviation.
@main-color: #f00;
.smth {
color: @main-color + #0f0;
}
Answer the question
In order to leave comments, you need to log in
Alternatively, you can override the value of the CSS variable with JS (see CSS custom properties)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question