Reputation: 24562
I have raw HTML in my model.question.text I was looking at the following:
app.directive('ngHtml', function() {
return function(scope, element, attrs) {
scope.$watch(attrs.ngHtml, function(value) {
element[0].innerHTML = value;
});
}
});
Can someone tell me if there is a simple way for me to include that in my page.
Upvotes: 2
Views: 45
Reputation: 691645
I think you're looking for ngBindHtmlUnsafe:
Creates a binding that will innerHTML the result of evaluating the expression into the current element. The innerHTML-ed content will not be sanitized! You should use this directive only if ngBindHtml directive is too restrictive and when you absolutely trust the source of the content you are binding to.
See $sanitize docs for examples.
Upvotes: 3