I've been attempting to encode object properties with links using HTML <a>
tags, but my current encoding attempt isn't working as expected. When I click on a country, the displayed links are not properly encoded.
Here is the code snippet where I tried to encode the links from the object:
chart.openPopup("<strong>" + ev.target.dataItem.dataContext.country + "</strong>" + country.link.map(url =>
'<br><a href="' + encodeURI(url.link) + '">Country specific links ' + '</a>').join(""));
I'm looking for guidance on how to rewrite the code to ensure that the links from the object's property are encoded correctly.
Please find the complete code snippet below: