Sophie Sophie - 1 month ago 14
HTML Question

HTML break line using <br> tag in <p> tag

In my HTML, I am using to show some text, like this:

<p> {{item.bio}} </p>


And here is the sample of bio object:

"bio": "A<br>B<br>C<br>D<br>E<br>F"


I was expecting that I'll get each and every alphabet in separate lines, but worst thing is when I run my HTML, showing me text as it is written with
<br>
tag.

Answer

Evaluates the expression and inserts the resulting HTML into the element in a secure way. Use ngSanitize in your module's dependencies.

Your code would we like:

<p ng-bind-html="item.bio"></p>

For more details read here.

Comments