How to visualize newlines in NoSQL data using a web browser?

How to have a long line and I would like to separate part of the text with a new line.

It seems \ n or \ n is not working or

What is in the database:

description: "Hello \n world" 

When I receive data, I receive

Hello World

Instead:

Hello

Peace

+5
source share
1 answer

Wrap the content with a <pre> tag so that it is formatted correctly.

 <pre>{{description}}</pre> 

Demo here


Other options are to use the ng-bind-html directive + add the ngSanitize module depending on the application

 <p ng-bind-html="description"></p> 

Plunkr

+5
source

All Articles