5

I have product data from database contains title, description... The description is in html format string, like this:

<b>Name:</b> iPhone 5;<br>
<b>Membery:</b> 8GB;<br>
<b>Condition:</b> Brand new;<br />

if supposed to be displayed like this:

Name: iPhone 5;

Memory: 8GB;

Condition: Brand new

But when I use data-binding in Angular2: {{product.description}}, it displays like pure text:

<b>Name:</b> iPhone 5; <br /><b>Memory:</b> 8GB;<br /><b>Condition:</b> Brand new;<br />

How should I display it correctly as html ? there is no html filter for the binding.

0

1 Answer 1

14

You can bind to innerHTML:

<div [innerHTML]="product.description"></div>
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.