I wish to escape the contents of the user entered value, so they show up as html entities. i.e. < would show up in the HTML markup as <
. But I want to wrap the user entered value with actual html. The idea is that I should be able to escape the user entered value, yet still trust the html.
Here is my html snippet:
<span ng-bind-html="trustHtml(notif.getConditionText())"></span>
Controller:
$scope.trustHtml = function(html) {
return $sce.trustAsHtml(html);
}
Notif:
getConditionText: function() {
return "<b>" + $sanitize(this.name) + "</b>";
}
I'm looking for a function that would go in place of $sanitize that would escape the user entered "name" property value. i.e. if they entered Seattle <rocks>
it would output the html as Seattle <rocks>
Anyone know of something like this for angular?
Note I am not trying to encode to URI entities, but HTML entities.