Sanitizing means that you explicitly specify Angular to consider the content safe. This is nothing more than a token for Angular that you take responsibility for, and Angular does not need to check the contents of potentially dangerous content. Only "sanitize" the content where you know where it came from and that it cannot contain harmful content.
This is why you need to bind it using property binding notation [innerHTML]="sanitizedConent
because when it innerHTML="{{sanitizedContent}}"
sanitizedContent
gets a string ( toString
) and the marker is lost in the process.
source
share