Rendering HTML Code from Variables in VisualNEO Web - Forum

Forum Navigation
You need to log in to create posts and topics.

Rendering HTML Code from Variables in VisualNEO Web

Hi everyone,

I'm working with VisualNEO Web and I have a question about rendering HTML code. I have a variable that contains HTML code as a string, but when I display this variable, it shows as plain text instead of rendering the HTML.

Is there a way in VisualNEO Web to render a variable's content as HTML rather than as plain text? If so, could someone provide guidance or examples on how to achieve this?

SetVar [x] "<p style='color:red;'>This is Breaking News </p>"

 

Thanks in advance for your help!

Best regards,
asmatqatea

@asmat you can do it using ng-bind-html advanced property. Just put there the desired variable: [myvariable]
Note that the HTML is sanitized previously to being rendered so you can not use inline style (style="...") but you are allowed to use class (class="...")

Thank you, Luis.

I receive data from the server in JSON format, and some attributes within these JSON objects occasionally contain HTML code. I've prepared an offline version demonstrating this issue. Please refer to the attached file for more details.

Uploaded files:
  • You need to login to have access to uploads.

@asmat take a look at this code:

<p class="readmore" ng-bind-html="[pinnedNews.readmore]"  style="color:gray;font-size:9pt;padding-left:10px;padding-right:10px;">
           [pinnedNews.readmore]
</p>

Can you see how to do it?

Yes, Thank you so much, Mr.Luis.