user3653474
user3653474

Reputation: 3852

Appending dynamic html in angular

I'm trying to load dynamic elements inside this paragraph text on button click

<p[innerHTML]>{{ result}}</p>

This is a text that i am sending rom my php application

<span class="red">This</span><span class="green">is</span><span class="blue">dynamic</span><span class="red">text</span>

i want to convert this html entities also on my angular component and css should also work right now these html entites and class are not working. It is printing as it is.

Thanks

Upvotes: 0

Views: 106

Answers (1)

Douglas Oliveira
Douglas Oliveira

Reputation: 426

Try it:

<p [innerHtml]="result"></p>

Upvotes: 1

Related Questions