I have a string str = "hello"+ "\n"+ "my"+ "\n" + "World".
html binding <div>{{str}}</div>
I expected to print this string as
Hello
my
world
I'm failing to do it but in console I'm getting what I want. Did I missing any thing here..
I have a string str = "hello"+ "\n"+ "my"+ "\n" + "World".
html binding <div>{{str}}</div>
I expected to print this string as
Hello
my
world
I'm failing to do it but in console I'm getting what I want. Did I missing any thing here..
Add <br> instead of \n and use innnerHtml tag in html
this.str = 'Hello' +'<br>'+ 'my' +'<br>' + 'world';
<div [innerHTML]="str"></div>
str for dynamic data, for each data I have different formats.str.replace('\n', '<br>')<br>
<div style="white-space: pre">{{str}}</div>pretag?