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:
ngSanitize
module on your app
eg: var app = angular.module('myApp', ['ngSanitize']);
ng-bind-html
the original html
content. No need to do anything else in your controller. The parsing and conversion is automatically done by the ngBindHtml
directive. (Read the How does it work
section on this: $sce). So, in your case <div ng-bind-html="preview_data.preview.embed.html"></div>
would do the work.