I get a string from my back-end and when I display it, < br/>
appears like text.
I'd like to convert them to real HTML tag or replace it by a real break line.
Here's the string retrieved from the back-end:
Description from backend Description from <br/> backend Description
from backend Description from backend <br/>Description <br/>from <br/>
backend Description from backend <br/> Description from backend
Description from backend Description from backend
Here's my function:
ngOnInit(): void {
this.uns = this.sentence$.subscribe(res => {
this.sentence = res;
if (this.sentence && this.sentence.length > 0) {
this.sentence = res.replace('<br/>', '\n');
}
});
}
{{sentence}}
I tried what you told me but it doesn't work. The text is displayed only without the < br> – Stev0x Jun 03 '20 at 10:18