newline to br
You don’t need any fancy pipes, all you need is plain old css.
Add the following to your name.component.css or name.component.scss (where name is the name of your component)
1 2 3 |
.nl2br { white-space: pre-line; } |
and later in your html, assuming your variable is called message.body
1 |
<div class="nl2br">{{message.body}}</div> |
And done. Enjoy simplicity.