D
D
DTX2017-01-24 16:30:46
JavaScript
DTX, 2017-01-24 16:30:46

How not to escape line break in Angular2?

<div>
    <textarea [(ngModel)]="comment.text"></textarea>
</div>
<div>{{comment.text}}</div>
<div [innerHTML]="comment.text"></div>

I get this:
BKPB2sG.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Z
Zakharov Alexander, 2017-01-24
@DirecTwiX

try using pre tags instead of div?
<pre>{{comment.text}}</pre>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question