Create Dynamic HTML Elements in Angular 2

0

Good morning!

I'm new to Angular 2 and I'm setting up a personal improvement project for a blog.

This "p" tag gets my text

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

I get the content of the text edited with HTML tags, however 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. Is there anything that does this for me in Angular 2?

Thank you in advance

    
asked by anonymous 25.05.2018 / 14:02

1 answer

0

You can do this as follows:

<p [innerHTML]="post.Texto"></p>
    
25.05.2018 / 14:48