I have an object having success, summary and detail elements used for displaying message in PrimeNG message (p-messages) after record is created. After record is created I call displayMessage method in order to set msg variable
form.ts:
...
this.displayMessage(data);
baseForm.ts:
displayMessage(data: string) {
var success = data["success"];
var summary = data["summary"];
var detail = data["detail"]; // <a href="http:/.... ">name</a>
this.msg.push({ success: success, summary: summary, detail: detail });
}
and then display message as shown below in html:
<p-messages [value]="msg"></p-messages>
However, the hyperlink tag “<a” is changed to “<a” and I think I need to sanitize the url by using something as explained on Angular 6 sanitize local drive url. Although I tried to use that method, I did not succeed because I need to sanitize the url in the detail variable and the related method is on the base class. So, how can I make the url display correctly? And what changes should be made in the given example?