To bind an HTML value to ng-bind-html
, you need to mark it as "trusted" first. Among other ways, you can do so with a custom filter.
# Filter in Coffeescript...:
@app.filter 'htmlSafe', ['$sce', ($sce) -> $sce.trustAsHtml ]
# ...or JS:
app.filter('htmlSafe', [
'$sce', function($sce) {
return $sce.trustAsHtml;
}
]);
# Usage:
<div ng-bind-html="item.value | htmlSafe"></div>
This is a replacement for the ng-bind-html-unsafe
directive which has been removed in Angular 1.2.
:party:
Posted to makandra dev (2014-11-13 18:04)