Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Web Technology by (47.6k points)

I'm trying to use $sanitize provider and the ng-bind-htm-unsafe directive to allow my controller to inject HTML into a DIV.

However, I can't get it to work.

<div ng-bind-html-unsafe="

{{preview_data.preview.embed.html}}"></div>

I discovered that it is because it was removed from AngularJS (thanks).

But without ng-bind-html-unsafe, I get this error:

http://errors.angularjs.org/undefined/$sce/unsafe

1 Answer

0 votes
by (106k points)

You can inject HTML with ng-bind-Html-unsafe remove by using $sanitize provider and the ng-bind-htm-unsafe directive to allow my controller to inject HTML into a DIV.

You can use the below-mentioned code it will help:-

<div ng-bind-html-unsafe="{{

preview_data.preview.embed.html}}">

</div>

Related questions

+2 votes
1 answer
+2 votes
2 answers
+2 votes
1 answer
+2 votes
1 answer
0 votes
1 answer

Browse Categories

...