A
A
Amir2018-11-11 18:59:51
Angular
Amir, 2018-11-11 18:59:51

Is it possible to pass color to template for css class?

Good afternoon.
There is such a question:
The color comes to the component from outside (always hex), let's say #abacaa
I need to pass it to the template:

<style parse-style>
.myClass {
  color: {{ myColor }}
}
</style>

But that doesn't work for me. Is there any way to implement this at all? And if possible, how?
Thanks in advance for the replies.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Q
Qairat, 2018-11-13
@Qairat

<div class="myClass">
  TEXT
</div>

<div [ngStyle]="{'color':  '#000000'}">
   TEXT
</div>

the only way.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question