Dynamically create HTML Elements at Angular 2

Asked

Viewed 348 times

0

Good Morning!

I’m new to Angular 2 and I’m putting together a blog for personal enhancement.

This "p" tag gets my text

<!-- Post Content -->
        <p id="post-aux">{{post.Texto}}</p>

I get the contents of the text edited with HTML tags, but I get a string of this text as in the example below:

    "<p>Olá Mundo</p>"

In Jquery I would use append to create this element in my HTML. There’s something that does that for me at Angular 2?

Grateful from now on

  • You can’t use Javascript?

1 answer

0


You can do it this way:

<p [innerHTML]="post.Texto"></p>
  • Minutes ago I saw a post talking about it and I ended up using the same, thank you very much for the help

Browser other questions tagged

You are not signed in. Login or sign up in order to post.