I am having issue with special character not being displayed properly, I am generating a d3.js tree layout diagram via an angular JS directive, text is being added into the diagram by the directive but any special character is not displayed properly, instead of apostrophe I get ' and & instead of & etc... I have tried the use of a filter $filter('html')(d.name)
with no luck
app.filter('html',function($sce){
return function(input){
var value = input.toString();
console.log(input);
var output = $sce.trustAsHtml(value);
console.log(output);
return output;
}
});
I also tried the following:
nodeEnter.append("text")
.attr("dy", 3)
.attr("x", 1e-6)
.attr("compile-template","")
.attr("ng-bind-html", function(d) {
var output = $sce.trustAsHtml(d.name);
return output;
})
OR
nodeEnter.append("text")
.attr("dy", 3)
.attr("x", 1e-6)
.text(function(d) {
var output = $sce.trustAsHtml(d.name);
return output;
})
Both without luck, is there any other way to get special characters to display through my directive?