A
A
Alex Krynytskyi2020-09-15 13:51:12
Angular
Alex Krynytskyi, 2020-09-15 13:51:12

How to pass text to Angular component?



there is a test.component.html component


that I need to specify in it so that I can use it something like this

Some RED TEXT

I inserted and wrote any text in it and it turned red right away. In order not to pass through a variable

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
acwartz, 2020-09-15
@NEOmanceR

test.component.html:

// Пускай это компонент <app-test></app-test>
<p style="color: red;"><ng-content></ng-content></p>

//app.html:
<app-test>Behold the RED TEXT!</app-test>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question