Angular nl2br

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)

and later in your html, assuming your variable is called message.body

And done. Enjoy simplicity.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.