angular - create a new line on HTML
Try this in HTML:
<pre>{{ alert.message }}</pre>
Already answered here:
The < pre > wrapper will print text with \n as text
I use the white-space: pre-wrap
CSS style, e.g. :
<p style="white-space: pre-wrap">{{alert.message}}</p>
\n
is not interpreted in html. You need to replace these instances with <br/>
elements. You could for example replace them with a regex if you do not want to change the original string.