HtmlView and ↵ character


#1

Hello,

I’m want to display a html text inside my app, I tried to put the text inside a HtmlView tag, but I get this error :

I don’t know what is wrong, I tried to change [html]=“AnObservableVariable” to html=“SimpleStringToTest” in the HtmlView and the second example works but not the first.


#2

HtmlView expects html property set to a valid string, not the text property.

More info: https://docs.nativescript.org/cookbook/ui/html-view


#3

sorry my mistake, I use html property but the variable was not a valid string. It worked when I added .toString() function to my variable.

I have another problem with HtmlView now : my string has a ‘↵’ character and it is not rendered in an HtmlView. I tried.replace('↵','<br/>') but it is not working, any ideas ?

Ok it is working now with : .replace(/\n/ig,'<br/>')