CodeZettaInterview Hub

Angular · Templates · Fresh / Intern · Best Practice

How do you safely bind HTML in Angular templates?

Short Interview Answer

Use [innerHTML] only with DomSanitizer after trusting content, or prefer text interpolation.

Detailed Explanation

Angular sanitizes by default against XSS. bypassSecurityTrustHtml is dangerous—only for trusted CMS content. Prefer markdown renderers with sanitization.

Did you know this answer?