Hi I'm currently using a REST service to pull in data and using angular to print the data in the front end.
The issue I have is that the string that's being pulled through has escaped entities like ' instead of ' (apostrophe) eg. "has been inspired by France's most popular neighbourhood".
decodeURI doesn't seem to work at all.
I've found a workaround by creating custom filter which makes creates a dummy element, sets the innerHTML to the dummy element, then taking it's innerHTML once it's been parsed and returning that value.
.filter("decoder", function() {
return function(item) {
var txt = item;
var dummy = document.createElement('p');
dummy.innerHTML = txt;
txt = dummy.innerHTML;
dummy.remove();
return txt;
}
})
It feels really dirty so I was wondering if their was a way to avoid DOM manipulation for this.
Thanks!
'or whatever?