Recently, I upgraded my application from angular 11 to 12 and also updated TypeScript from 4.0.5 to 4.3.5. One noticeable difference we encountered is that instead of having an empty value, the text "null" now appears in the application.
https://i.sstatic.net/b9kUi.png
After narrowing down the issue, it seems to revolve around the following code snippet (I intentionally set the value to null for demonstration purposes):
<div>
<span [innerHTML]="null | sanitizeHtml"></span>
</div>
The problem lies within the bypassSecurityTrustHtml
method or how the safeHtml object is handled when dealing with a null value. Can someone provide insight into this behavior?
EDIT
To replicate the issue, here's a stackblitz example: https://stackblitz.com/edit/angular-v12-ejwhmd?file=package.json
EDIT 2
I've submitted a bug report to Angular: https://github.com/angular/angular/issues/43794