Closed ambersun1234 closed 2 years ago
Simple solution:
<b class="content">Some descriptions</b>
Thanks 👍
The problem is that you are passing html in a string to the nzContent, and angular doesn't trust it. You can pass template
to nzContent
.
https://angular.io/api/platform-browser/DomSanitizer
Reproduction link
https://stackblitz.com/edit/ng-zorro-antd-ivy-xmiw8l
Steps to reproduce
What is expected?
What is actually happening?
Angular will automatically run sanitize to the content causing the style being removed from the content, although we can use bypassSecurityTrustHtml to make it work, but it will cause the security issue.\ I wonder if there's a better way to achieve this