I have a comment textbox and I want only to allow a[href] as safe html with ngSanitize/$sce. So I'm trying this:
<span contact-highlight hightlight-value="showedText" ng-bind-html="showedText"></span>
And inside my contactHiglight directive I have this:
contentObjectApp.directive('contactHighlight', function ($sce) {
return {
restrict: 'A',
scope: { hightlightValue: '=' },
link: function ($scope, $element, $attrs) {
$scope.hightlightValue = "<h2> testing" + $sce.trustAsHtml('<a href="#">render me please</a>') + " </h2>";
}
};
});
I ways expecting to only allow the 'render me please' to become a href link but I always expecting to be rendered as well. What am I missing? Is there an easy way to do this?