1

I have created an list with Multiline text column. I am adding some text and some HTML. Once I read the value from text in angular js, and print it on screen, the HTML block written in the column is also rendered as text and not HTML.

How can I achieve this?

For reference: Value inside multiline column is :

This is the video 
<video src=""></video>

1 Answer 1

3

You need to use Angular's ng-bind-html directive.

In the html, it would be something like : <span ng-bind-html="item.Description"></span>

In your controller, you need to set the value of description as below:

Description: $sce.trustAsHtml(data.Description)

In your controller, also ensure that $sce is present as below:

myApp.controller('MyController', ['$sce', function($sce) {
    // ... [your code]
 }]);

Reference - ngBindHtml

$sce - Strict Contextual Escaping

use $sce.trustAsHtml(string) to replicate ng-bind-html-unsafe in Angular

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.