p-Message do not show html content anymore
[X ] bug report => Search github for a similar issue or PR before submitting
- Angular version: 9.X
- PrimeNG version: 9.0.6
In our project, we are using MessageService to display alerts having html content. But p-messages do not render the hmtl content anymore. (We do not use any template in p-messages)
After checking the code I have successfully find a workaround by using the attribute [escape]='false' of the p-messages components. I seems the problem is related of the escape default value (true) and caused by the usage of interpolation to display the message in the template html code instead of the [innerHTML]. Here below the html code from messages.ts file.
<li *ngFor="let msg of value">
<div *ngIf="!escape; else escapeOut">
<span *ngIf="msg.summary" class="ui-messages-summary" [innerHTML]="msg.summary"></span>
<span *ngIf="msg.detail" class="ui-messages-detail" [innerHTML]="msg.detail"></span>
</div>
<ng-template #escapeOut>
<span *ngIf="msg.summary" class="ui-messages-summary">{{msg.summary}}</span>
<span *ngIf="msg.detail" class="ui-messages-detail">{{msg.detail}}</span>
</ng-template>
</li>
I confirm that we also have this problem. Thank you @fxvits for the workaround.
You can use escape="false" in message. <p-message ... [escape]="false">