After thorough research, all I've come across are solutions that demonstrate how to display the newline character as a new line.
I specifically aim to exhibit the "\n"
as a string within an Angular view. It appears that Angular disregards it by default.
Sample Text:
this.myText = "This is my \n example \n string: \n"
Result of
<div>{{ myText }}</div>
:
"This is my example string:"
Intended Output:
"This is my \n example \n string: \n"
Access Stackblitz for demonstration: HERE
--
In other words, using
style="white-space: pre-line"
or <pre></pre>
or [innerText]="myText"
is not the solution I am seeking, as I do not want the \n to be interpreted as a new line.
Your assistance is greatly appreciated!