I am getting "First Line.↵Second Line↵"
as a string in an api response.I want to take this and print in html web page like <span>{{apiText}}</span>
. where apiText is a javascript variable whose value is "First Line.↵Second Line↵"
. But the text appears on one line only.How to I convert ↵
to a format where it prints a break.
That cr character is \n
.
You can replace those with <br>
tag.
refinedText: Ember.computed('apiText', function(){
return this.get('apiText').replace('\n', '<br>');
})
and in template :
{{{refinedText}}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With